Cleanup: correct asserts

Also remove redundant assert.
This commit is contained in:
Campbell Barton
2024-04-25 12:02:14 +10:00
parent 29dd91815f
commit 08b3db500f
4 changed files with 6 additions and 6 deletions

View File

@@ -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;
}

View File

@@ -383,6 +383,7 @@ PanelType *gpencil_modifier_subpanel_register(ARegionType *region_type,
{
PanelType *panel_type = static_cast<PanelType *>(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));

View File

@@ -491,6 +491,7 @@ PanelType *modifier_subpanel_register(ARegionType *region_type,
{
PanelType *panel_type = MEM_cnew<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");
@@ -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));

View File

@@ -253,6 +253,7 @@ PanelType *shaderfx_subpanel_register(ARegionType *region_type,
{
PanelType *panel_type = static_cast<PanelType *>(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));