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.
This commit is contained in:
Hans Goudey 2020-11-17 10:28:57 -05:00
parent d952d1792a
commit ea7aae88cf
1 changed files with 9 additions and 3 deletions

View File

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