[Bf-blender-cvs] [ea7aae88cfe] master: Cleanup: Remove unecessary NULL check

Hans Goudey noreply at git.blender.org
Tue Nov 17 16:29:27 CET 2020


Commit: ea7aae88cfe13ae55c1c9c91e968d55c89e1a3b2
Author: Hans Goudey
Date:   Tue Nov 17 10:28:57 2020 -0500
Branches: master
https://developer.blender.org/rBea7aae88cfe13ae55c1c9c91e968d55c89e1a3b2

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.

===================================================================

M	source/blender/editors/interface/interface_layout.c

===================================================================

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



More information about the Bf-blender-cvs mailing list