diff options
author | Julian Eisel <julian@blender.org> | 2022-03-29 16:17:25 +0300 |
---|---|---|
committer | Fabian Schempp <fabianschempp@googlemail.com> | 2022-04-11 01:31:47 +0300 |
commit | 30104713e51375fc7adab490f898ffa82729bc50 (patch) | |
tree | 252ea38cfd226d74254da3a3cc45dbb8b40c3c7d | |
parent | c59a25d341790725bd575427b969e600300aecc2 (diff) |
Fix T96844: Crash when switching workspaces and outliner modes
Error exposed by ba49345705a3. Code just assumed that the tree-element
pointed to a real ID, but this is often not the case, and the ID pointer
contains completely different data. E.g. before ba49345705a3, it would
be a pointer to one of the `Main` listbases, so this code would have
undefined behavior. Now the pointer is null for elements in the "Current
File" element, causing a null-pointer dereference rather than undefined
behavior (that just happened to virtually always result in the intended
code path).
-rw-r--r-- | source/blender/editors/space_outliner/outliner_tree.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.cc b/source/blender/editors/space_outliner/outliner_tree.cc index 19fe40b612e..bbd9b48c260 100644 --- a/source/blender/editors/space_outliner/outliner_tree.cc +++ b/source/blender/editors/space_outliner/outliner_tree.cc @@ -712,7 +712,8 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner, else { /* do not extend Armature when we have posemode */ tselem = TREESTORE(te->parent); - if (GS(tselem->id->name) == ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE) { + if (TSE_IS_REAL_ID(tselem) && GS(tselem->id->name) == ID_OB && + ((Object *)tselem->id)->mode & OB_MODE_POSE) { /* pass */ } else { |