status2d: Minor protection against crashes due to invalid x and y values

This commit is contained in:
bakkeby 2020-05-31 15:14:07 +02:00
parent 7b2c30b371
commit e7ea06a0c2

View File

@ -108,6 +108,11 @@ drawstatusbar(Monitor *m, int bh, char* stext, int stw, int stp)
while (text[++i] != ',');
int rh = atoi(text + ++i);
if (ry < 0)
ry = 0;
if (rx < 0)
rx = 0;
drw_rect(drw, rx + x, ry, rw, rh, 1, 0);
} else if (text[i] == 'f') {
x += atoi(text + ++i);
@ -172,4 +177,4 @@ status2dtextlength(char* stext)
else
isCode = 0;
return w;
}
}