From ea7aae88cfe13ae55c1c9c91e968d55c89e1a3b2 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 17 Nov 2020 10:28:57 -0500 Subject: Cleanup: Remove unecessary NULL check Panels for active uiBlocks always have a type, because the process that makes them uses the types. Add an assert just to make it clear that the assumption is purposeful. --- source/blender/editors/interface/interface_layout.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 6267681bb4d..bd42e5db531 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5169,8 +5169,14 @@ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) return false; } - if (block->panel && block->panel->type && block->panel->type->flag & PANEL_TYPE_NO_SEARCH) { - return false; + Panel *panel = block->panel; + + if (panel != NULL && 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 != NULL); + if (panel->type->flag & PANEL_TYPE_NO_SEARCH) { + return false; + } } const bool panel_label_matches = block_search_panel_label_matches(block, search_filter); @@ -5179,7 +5185,7 @@ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) true : block_search_filter_tag_buttons(block, search_filter); - if (block->panel != NULL) { + if (panel != NULL) { if (has_result) { ui_panel_tag_search_filter_match(block->panel); } -- cgit v1.2.3