Commit: ff1f5236ac7218c9f8cbebf8492885a0544d9b6a
Author: Julian Eisel
Date:   Tue Jun 14 15:51:03 2022 +0200
Branches: blender-v3.2-release
https://developer.blender.org/rBff1f5236ac7218c9f8cbebf8492885a0544d9b6a

Fix T98753: Outliner Unlink material in Blender File mode crashes

This issue was only exposed by ba49345705a3. The ID pointer of the
material's parent tree-element wasn't actually pointing to an ID, but to
the list-base containing the IDs. It was just unlikely to cause issues
in practice, although an assert was thrown.

Just don't do anything if the object or object-data to unlink the
material from could not be found. The following commit will introduce a
error message about this.

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

M       source/blender/editors/space_outliner/outliner_tools.cc

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

diff --git a/source/blender/editors/space_outliner/outliner_tools.cc 
b/source/blender/editors/space_outliner/outliner_tools.cc
index 5da64177e51..3fc6e6969c5 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -228,6 +228,12 @@ static void unlink_material_fn(bContext *UNUSED(C),
                                TreeStoreElem *UNUSED(tselem),
                                void *UNUSED(user_data))
 {
+  if (!tsep || !TSE_IS_REAL_ID(tsep)) {
+    /* Valid case, no parent element of the material or it is not an ID (could 
be a #TSE_ID_BASE
+     * for example) so there's no data to unlink from. */
+    return;
+  }
+
   Material **matar = nullptr;
   int a, totcol = 0;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to