diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-11-14 01:47:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-11-14 01:47:23 +0300 |
commit | c1d29ea7835c0f2ebd20531dfe3996c6bbce6b58 (patch) | |
tree | d7854c52ba16975cb31910bfd5ad041b1ed71213 /source/blender/windowmanager/intern | |
parent | a5a86f39212fb16c8310d8eca67ccecc4c6f7dd7 (diff) |
WM: enforce descriptions being NULL or defined
Without this bugs slip through that don't null check the descriptions
since many were set to empty strings.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_menu_type.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_type.c | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_menu_type.c b/source/blender/windowmanager/intern/wm_menu_type.c index 58e85716bf1..4e71001990d 100644 --- a/source/blender/windowmanager/intern/wm_menu_type.c +++ b/source/blender/windowmanager/intern/wm_menu_type.c @@ -60,6 +60,7 @@ MenuType *WM_menutype_find(const char *idname, bool quiet) bool WM_menutype_add(MenuType *mt) { + BLI_assert((mt->description == NULL) || (mt->description[0])); BLI_ghash_insert(menutypes_hash, mt->idname, mt); return true; } diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index 25ca84f3d57..e9287d83a9a 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -116,6 +116,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType *)) if (ot->name == NULL) { CLOG_ERROR(WM_LOG_OPERATORS, "Operator '%s' has no name property", ot->idname); } + BLI_assert((ot->description == NULL) || (ot->description[0])); /* XXX All ops should have a description but for now allow them not to. */ RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : UNDOCUMENTED_OPERATOR_TIP); @@ -134,6 +135,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType *, void *), void * RNA_def_struct_translation_context(ot->srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT); ot->translation_context = BLT_I18NCONTEXT_OPERATOR_DEFAULT; opfunc(ot, userdata); + BLI_assert((ot->description == NULL) || (ot->description[0])); RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : UNDOCUMENTED_OPERATOR_TIP); RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname); |