aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
authorMarisa-Chan2019-10-11 18:57:10 +0700
committerEugene Sandulenko2019-10-13 15:29:25 +0200
commit288ea5783e3f2bbd491020f6b589c2853f90113a (patch)
treea601c1a61394133db89ec5f2302353c251da27a6 /graphics/macgui
parentaf2777e45c28c756ffd24883cd38a64c4cef77e4 (diff)
downloadscummvm-rg350-288ea5783e3f2bbd491020f6b589c2853f90113a.tar.gz
scummvm-rg350-288ea5783e3f2bbd491020f6b589c2853f90113a.tar.bz2
scummvm-rg350-288ea5783e3f2bbd491020f6b589c2853f90113a.zip
GRAPHICS: MACGUI: Fix assertion if shortcut in menu element is a last symbol
Diffstat (limited to 'graphics/macgui')
-rw-r--r--graphics/macgui/macmenu.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index d8fc4a6464..87298e2be1 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -629,7 +629,10 @@ static void underlineAccelerator(ManagedSurface *dst, const Font *font, const Co
Common::U32String s(str);
- s.erase(shortcutPos + 1);
+ // Erase characters only if it is not end of the string
+ if ((uint)(shortcutPos + 1) < s.size())
+ s.erase(shortcutPos + 1);
+
int pos2 = font->getStringWidth(s);
s.deleteLastChar();
int pos1 = font->getStringWidth(s);