mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #15466: Crash when opening dropdown with 0 rows
This commit is contained in:
parent
b762cb26ed
commit
62a9096079
|
@ -33,6 +33,7 @@
|
|||
- Fix: [#15322] Circus music doesn't play.
|
||||
- Fix: [#15377] Entrance/exit ghost doesn't work on different stations without touching them first.
|
||||
- Fix: [#15451] Guest list name filter remains after group selection.
|
||||
- Fix: [#15466] Crash when opening a dropdown with 0 rows.
|
||||
- Fix: [#15476] Crash when placing/clearing small scenery.
|
||||
- Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2.
|
||||
- Fix: [#15490] Tile inspector needlessly updates clearance height when changing surface slopes.
|
||||
|
|
|
@ -157,7 +157,7 @@ void WindowDropdownShowTextCustomWidth(
|
|||
if (gDropdownNumItems == 0)
|
||||
{
|
||||
_dropdown_num_columns = 1;
|
||||
_dropdown_num_rows = 0;
|
||||
_dropdown_num_rows = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -231,15 +231,15 @@ void WindowDropdownShowImage(
|
|||
_dropdown_item_width = itemWidth;
|
||||
_dropdown_item_height = itemHeight;
|
||||
gDropdownNumItems = numItems;
|
||||
// There must always be at least one column to prevent dividing by zero
|
||||
// There must always be at least one column and row to prevent dividing by zero
|
||||
if (gDropdownNumItems == 0)
|
||||
{
|
||||
_dropdown_num_columns = 1;
|
||||
_dropdown_num_rows = 0;
|
||||
_dropdown_num_rows = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_dropdown_num_columns = numColumns;
|
||||
_dropdown_num_columns = std::max(1, numColumns);
|
||||
_dropdown_num_rows = gDropdownNumItems / _dropdown_num_columns;
|
||||
if (gDropdownNumItems % _dropdown_num_columns != 0)
|
||||
_dropdown_num_rows++;
|
||||
|
|
Loading…
Reference in New Issue