aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui
diff options
context:
space:
mode:
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);