Don't increment number of status items before comparing with maximum.
Fixes segfault when connecting an USB disk and all of the 10 slots are in use.
This commit is contained in:
parent
77cc12cce5
commit
6781067b55
@ -934,8 +934,10 @@ int bx_gui_c::register_statusitem(const char *text, bool auto_off)
|
||||
}
|
||||
}
|
||||
if (id == statusitem_count) {
|
||||
if (++statusitem_count > BX_MAX_STATUSITEMS) {
|
||||
if (statusitem_count == BX_MAX_STATUSITEMS) {
|
||||
return -1;
|
||||
} else {
|
||||
statusitem_count++;
|
||||
}
|
||||
}
|
||||
statusitem[id].in_use = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user