[Bf-blender-cvs] [2400160bc42] temp-ui-button-type-refactor: Fix missing NULL checks for buttons without layout

Julian Eisel noreply at git.blender.org
Sun Jun 7 23:48:00 CEST 2020


Commit: 2400160bc42d58a7a757f42b6906c4a7add948d7
Author: Julian Eisel
Date:   Sun Jun 7 23:45:37 2020 +0200
Branches: temp-ui-button-type-refactor
https://developer.blender.org/rB2400160bc42d58a7a757f42b6906c4a7add948d7

Fix missing NULL checks for buttons without layout

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

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

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

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e640824a1b7..04477eb883f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3819,9 +3819,11 @@ uiBut *ui_but_change_type(uiBut *but, eButType new_type)
 
       BLI_insertlinkafter(&but->block->buttons, insert_after_but, but);
 
-      const bool found_layout = ui_layout_replace_but_ptr(but->layout, old_but_ptr, but);
-      BLI_assert(found_layout);
-      UNUSED_VARS_NDEBUG(found_layout);
+      if (but->layout) {
+        const bool found_layout = ui_layout_replace_but_ptr(but->layout, old_but_ptr, but);
+        BLI_assert(found_layout);
+        UNUSED_VARS_NDEBUG(found_layout);
+      }
     }
   }



More information about the Bf-blender-cvs mailing list