diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 0910d06fb23..849044286d8 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -133,7 +133,15 @@ void GuiManager::pushKeymap() { } void GuiManager::popKeymap() { - _system->getEventManager()->getKeymapper()->popKeymap(); + Common::Keymapper *keymapper = _system->getEventManager()->getKeymapper(); + if (!keymapper->getActiveStack().empty()) { + Common::Keymapper::MapRecord topKeymap = keymapper->getActiveStack().top(); + // TODO: Don't use the keymap name as a way to discriminate GUI maps + if(topKeymap.keymap->getName().equals(Common::kGuiKeymapName)) + keymapper->popKeymap(); + else + warning("An attempt to pop non-gui keymap %s was blocked", topKeymap.keymap->getName().c_str()); + } } #endif