Skip to content

Commit 2e1f992

Browse files
committed
ui/menu.cpp: Fix calculation mistake that resulted in NaNs being passed to the renderer, causing assertion failures in debug builds
1 parent f4eef2d commit 2e1f992

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/frontend/mame/ui/menu.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,9 @@ void menu::draw(uint32_t flags)
667667

668668
// compute top/left of inner menu area by centering
669669
float const visible_left = (1.0F - visible_width) * 0.5F;
670-
m_items_top = std::round((((1.0F - visible_main_menu_height - visible_extra_menu_height) * 0.5F) + top_extra_menu_height) * float(m_last_size.second)) / float(m_last_size.second);
670+
m_items_top = ((1.0F - visible_main_menu_height - visible_extra_menu_height) * 0.5F) + top_extra_menu_height;
671+
if (m_last_size.second != 0)
672+
m_items_top = std::round(m_items_top * float(m_last_size.second)) / float(m_last_size.second);
671673

672674
// first add us a box
673675
float const x1 = visible_left - lr_border();

0 commit comments

Comments
 (0)