added return in guard clause for empty drawcmd buffer

draw(cmd) had a bug causing the first drawcmd in every frame to be added twice, for text this would cause a double free
pull/2/head
Sara 2023-05-05 22:17:28 +02:00
parent 2b927259a8
commit b898fd5b31
1 changed files with 1 additions and 0 deletions

View File

@ -344,6 +344,7 @@ void insert_drawcmd_at(size_t index, const drawcmd_t* cmd) {
void draw(const drawcmd_t* cmd) { void draw(const drawcmd_t* cmd) {
if(g_drawdata_endptr == g_drawdata) { if(g_drawdata_endptr == g_drawdata) {
insert_drawcmd_at(0, cmd); insert_drawcmd_at(0, cmd);
return;
} }
long top = (size_t)(g_drawdata_endptr - g_drawdata), long top = (size_t)(g_drawdata_endptr - g_drawdata),
bot = 0, bot = 0,