From 08b3db500f84e7bc6167cb7397424b7c9630e2d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 25 Apr 2024 12:02:14 +1000 Subject: [PATCH] Cleanup: correct asserts Also remove redundant assert. --- source/blender/editors/interface/interface_layout.cc | 6 +++--- .../intern/MOD_gpencil_legacy_ui_common.cc | 2 +- source/blender/modifiers/intern/MOD_ui_common.cc | 2 +- source/blender/shader_fx/intern/FX_ui_common.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 862150509a0..d5f099f5698 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -5487,9 +5487,9 @@ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) Panel *panel = block->panel; - if (panel != nullptr && panel->type->flag & PANEL_TYPE_NO_SEARCH) { - /* Panels for active blocks should always have a type, otherwise they wouldn't be created. */ - BLI_assert(block->panel->type != nullptr); + if (panel != nullptr) { + /* Panels for active blocks should always have a valid `panel->type`, + * otherwise they wouldn't be created. */ if (panel->type->flag & PANEL_TYPE_NO_SEARCH) { return false; } diff --git a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc index 4a3a2485ecb..aa06593b772 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc +++ b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc @@ -383,6 +383,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type, { PanelType *panel_type = static_cast(MEM_callocN(sizeof(PanelType), __func__)); + BLI_assert(parent != nullptr); SNPRINTF(panel_type->idname, "%s_%s", parent->idname, name); STRNCPY(panel_type->label, label); STRNCPY(panel_type->context, "modifier"); @@ -393,7 +394,6 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type, panel_type->poll = gpencil_modifier_ui_poll; panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED; - BLI_assert(parent != nullptr); STRNCPY(panel_type->parent_id, parent->idname); panel_type->parent = parent; BLI_addtail(&parent->children, BLI_genericNodeN(panel_type)); diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index 54a901631ae..e3041816ce4 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -491,6 +491,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type, { PanelType *panel_type = MEM_cnew(__func__); + BLI_assert(parent != nullptr); SNPRINTF(panel_type->idname, "%s_%s", parent->idname, name); STRNCPY(panel_type->label, label); STRNCPY(panel_type->context, "modifier"); @@ -502,7 +503,6 @@ PanelType *modifier_subpanel_register(ARegionType *region_type, panel_type->poll = modifier_ui_poll; panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED; - BLI_assert(parent != nullptr); STRNCPY(panel_type->parent_id, parent->idname); panel_type->parent = parent; BLI_addtail(&parent->children, BLI_genericNodeN(panel_type)); diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index 4d81851b28b..42975b31782 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -253,6 +253,7 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type, { PanelType *panel_type = static_cast(MEM_callocN(sizeof(PanelType), __func__)); + BLI_assert(parent != nullptr); SNPRINTF(panel_type->idname, "%s_%s", parent->idname, name); STRNCPY(panel_type->label, label); STRNCPY(panel_type->context, "shaderfx"); @@ -263,7 +264,6 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type, panel_type->poll = shaderfx_ui_poll; panel_type->flag = PANEL_TYPE_DEFAULT_CLOSED; - BLI_assert(parent != nullptr); STRNCPY(panel_type->parent_id, parent->idname); panel_type->parent = parent; BLI_addtail(&parent->children, BLI_genericNodeN(panel_type));