diff options
author | Hans Goudey <h.goudey@me.com> | 2020-11-17 18:28:57 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-11-17 18:28:57 +0300 |
commit | ea7aae88cfe13ae55c1c9c91e968d55c89e1a3b2 (patch) | |
tree | ebd3453a63874dfa4c3981e569c87596f20c2da5 /source/blender/editors/interface/interface_layout.c | |
parent | d952d1792ab167b2b3cc9fdde26d70a5ec9641b0 (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 12 |
1 files changed, 9 insertions, 3 deletions
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); } |