From 2e1f992c45bddff397b82beea4c5241896bf22e7 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 18 Dec 2024 11:40:04 -0500 Subject: ui/menu.cpp: Fix calculation mistake that resulted in NaNs being passed to the renderer, causing assertion failures in debug builds --- src/frontend/mame/ui/menu.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 76f77261ea0..6f588bcc17f 100644 --- a/src/frontend/mame/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -667,7 +667,9 @@ void menu::draw(uint32_t flags) // compute top/left of inner menu area by centering float const visible_left = (1.0F - visible_width) * 0.5F; - 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); + m_items_top = ((1.0F - visible_main_menu_height - visible_extra_menu_height) * 0.5F) + top_extra_menu_height; + if (m_last_size.second != 0) + m_items_top = std::round(m_items_top * float(m_last_size.second)) / float(m_last_size.second); // first add us a box float const x1 = visible_left - lr_border(); -- cgit v1.2.3