[Bf-blender-cvs] [3a65397473e] master: Fix T75471: Outliner: crash selecting modifier objects/targets that are in a excluded collection

Philipp Oeser noreply at git.blender.org
Tue Apr 7 15:13:13 CEST 2020


Commit: 3a65397473e7a60b606489ea154687a16f656b6b
Author: Philipp Oeser
Date:   Tue Apr 7 12:59:46 2020 +0200
Branches: master
https://developer.blender.org/rB3a65397473e7a60b606489ea154687a16f656b6b

Fix T75471: Outliner: crash selecting modifier objects/targets that are in a excluded collection

There is no garuantee 'outliner_find_id()' can find those corresponding
TreeElements, safeguard against failure now.

note: not sure why this was no problem in Release builds? (could only
reproduce crashes in Debug builds...)

Maniphest Tasks: T75471

Differential Revision: https://developer.blender.org/D7365

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

M	source/blender/editors/space_outliner/outliner_select.c

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

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index ec1595eb930..64d86293fb7 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -312,6 +312,7 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
   Scene *sce;
   Base *base;
   Object *ob = NULL;
+  TreeElement *te_ob = NULL;
 
   /* if id is not object, we search back */
   if (te->idcode == ID_OB) {
@@ -355,8 +356,12 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
     }
   }
 
-  parent_tselem = TREESTORE(outliner_find_id(soops, &soops->tree, (ID *)ob));
-  if (base) {
+  te_ob = outliner_find_id(soops, &soops->tree, (ID *)ob);
+  if (te_ob != NULL) {
+    parent_tselem = TREESTORE(te_ob);
+  }
+
+  if (!ELEM(NULL, parent_tselem, base)) {
     if (set == OL_SETSEL_EXTEND) {
       /* swap select */
       if (base->flag & BASE_SELECTED) {



More information about the Bf-blender-cvs mailing list