Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-06-14 16:51:03 +0300
committerJulian Eisel <julian@blender.org>2022-06-14 17:21:12 +0300
commite772087ed664ffcc230850837558415cc9015f71 (patch)
treec7662192ab42b3f66a0aef2d23b130e338b358d0 /source/blender/editors/space_outliner
parentc7942c31b2a90b16c3029120f95ae1ebf0d8a2d8 (diff)
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.
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index 475d02020d0..5c7b0732beb 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -229,6 +229,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;