Keymap: warn when running poll on empty keymaps
authorCampbell Barton <ideasman42@gmail.com>
Sat, 13 Apr 2019 17:22:08 +0000 (19:22 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 13 Apr 2019 17:26:01 +0000 (19:26 +0200)
source/blender/windowmanager/intern/wm_keymap.c

index 8b9a44d..ba9accb 100644 (file)
@@ -444,6 +444,12 @@ bool WM_keymap_poll(bContext *C, wmKeyMap *keymap)
                }
        }
 
+       if (UNLIKELY(BLI_listbase_is_empty(&keymap->items))) {
+               /* Empty key-maps may be missing more there may be a typo in the name.
+                * Warn early to avoid loosing time investigating each case. */
+               CLOG_WARN(WM_LOG_KEYMAPS, "empty keymap '%s'", keymap->idname);
+       }
+
        if (keymap->poll != NULL) {
                return keymap->poll(C);
        }