diff options
| author | 2024-12-18 11:40:04 -0500 | |
|---|---|---|
| committer | 2024-12-18 11:40:04 -0500 | |
| commit | 2e1f992c45bddff397b82beea4c5241896bf22e7 (patch) | |
| tree | fb0bee189e70584ef77f9bbf22027c288ee07a6f /src/frontend | |
| parent | f4eef2d80f14bd891971094c3280a6fd0656f7cf (diff) | |
ui/menu.cpp: Fix calculation mistake that resulted in NaNs being passed to the renderer, causing assertion failures in debug builds
Diffstat (limited to 'src/frontend')
| -rw-r--r-- | src/frontend/mame/ui/menu.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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(); |
