diff --git a/gemrb/core/GUI/Button.cpp b/gemrb/core/GUI/Button.cpp index 5cf1427770..3f6dc40d6e 100644 --- a/gemrb/core/GUI/Button.cpp +++ b/gemrb/core/GUI/Button.cpp @@ -755,10 +755,6 @@ void Button::SetPushOffset(ieWord x, ieWord y) bool Button::SetHotKey(KeyboardKey key, short mod, bool global) { - if (key < ' ') { - return false; - } - UnregisterHotKey(); if (global) { diff --git a/gemrb/core/GUI/EventMgr.cpp b/gemrb/core/GUI/EventMgr.cpp index 91eff459b2..96e9d7eb77 100644 --- a/gemrb/core/GUI/EventMgr.cpp +++ b/gemrb/core/GUI/EventMgr.cpp @@ -155,6 +155,10 @@ void EventMgr::DispatchEvent(Event& e) bool EventMgr::RegisterHotKeyCallback(EventCallback* cb, KeyboardKey key, short mod) { + if (key < ' ') { + return false; + } + int flags = mod << 16; flags |= key; diff --git a/gemrb/core/GUI/Window.cpp b/gemrb/core/GUI/Window.cpp index 1f80ca18f8..d603f4c350 100644 --- a/gemrb/core/GUI/Window.cpp +++ b/gemrb/core/GUI/Window.cpp @@ -395,6 +395,10 @@ bool Window::InHandler() const bool Window::RegisterHotKeyCallback(EventMgr::EventCallback* cb, KeyboardKey key) { + if (key < ' ') { + return false; + } + std::map::iterator it; it = HotKeys.find(key); if (it != HotKeys.end()) {