| [AD] Tiny bug in guiproc.c | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
There's a tiny bug in guiproc.c, in the _draw_listbox function().
If the width of the listbox is (<=22 and bar=true) or (<=10 and bar=false),
this function will fall into an endless loop.
WIP 3.9.24, line 990
   while (text_length(font, s) >= d->w - (bar ? 22 : 10)) {
      len--;
      usetat(s, len, 0);
   }
The problem is that the right side expression will always be <=0 
and the loop will never end. 
Here is a quick fix:
   if (d->w - (bar ? 22 : 10) > 0) {
      while (text_length(font, s) >= d->w - (bar ? 22 : 10)) {
         len--;
         usetat(s, len, 0);
      }
   }
   else
      usetat(s, 0, 0);
Pavlos