don't allow resizing client beyond number of items

This commit is contained in:
speedie 2023-03-19 14:26:36 +01:00
parent 1f05283ce1
commit ed682dca2d

View file

@ -47,9 +47,15 @@ void
resizeclient(void) resizeclient(void)
{ {
int omh = mh; int omh = mh;
struct item *item;
int itemCount = 0;
// walk through all items
for (item = items; item && item->text; item++)
itemCount++;
bh = MAX(drw->font->h, drw->font->h + 2 + lineheight); bh = MAX(drw->font->h, drw->font->h + 2 + lineheight);
lines = MAX(lines, 0); lines = MIN(itemCount, MAX(lines, 0));
reallines = lines; reallines = lines;
#if USEIMAGE #if USEIMAGE