diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-22 04:52:49 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-22 06:47:17 +0300 |
commit | ef063751595109efd098b990cc364bd67ca9e2a9 (patch) | |
tree | 097d1eb851d57cc561cf0d96b8ecde4a4843e318 | |
parent | 7ce09ef48f5f00588030c825aba29f6fd4df83cc (diff) |
GHOST: assert when unknown keys are passed to the ModifierKeys API
-rw-r--r-- | intern/ghost/intern/GHOST_ModifierKeys.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.cpp b/intern/ghost/intern/GHOST_ModifierKeys.cpp index 10f2e8019a7..5ecbae77f46 100644 --- a/intern/ghost/intern/GHOST_ModifierKeys.cpp +++ b/intern/ghost/intern/GHOST_ModifierKeys.cpp @@ -10,6 +10,7 @@ */ #include "GHOST_ModifierKeys.h" +#include "GHOST_Debug.h" GHOST_ModifierKeys::GHOST_ModifierKeys() { @@ -49,7 +50,8 @@ GHOST_TKey GHOST_ModifierKeys::getModifierKeyCode(GHOST_TModifierKey mask) key = GHOST_kKeyRightOS; break; default: - // Should not happen + /* Should not happen. */ + GHOST_ASSERT(0, "Invalid key!"); key = GHOST_kKeyUnknown; break; } @@ -76,6 +78,7 @@ bool GHOST_ModifierKeys::get(GHOST_TModifierKey mask) const case GHOST_kModifierKeyRightOS: return m_RightOS; default: + GHOST_ASSERT(0, "Invalid key!"); return false; } } @@ -108,6 +111,7 @@ void GHOST_ModifierKeys::set(GHOST_TModifierKey mask, bool down) m_RightOS = down; break; default: + GHOST_ASSERT(0, "Invalid key!"); break; } } |