diff options
-rw-r--r-- | source/blender/editors/space_outliner/tree/tree_element.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/space_outliner/tree/tree_element.cc b/source/blender/editors/space_outliner/tree/tree_element.cc index 7fe3f08b3be..1e3fd2df7c2 100644 --- a/source/blender/editors/space_outliner/tree/tree_element.cc +++ b/source/blender/editors/space_outliner/tree/tree_element.cc @@ -33,7 +33,9 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i TreeElement &legacy_te, void *idv) { - ID &id = *static_cast<ID *>(idv); + if (idv == nullptr) { + return nullptr; + } /* * The following calls make an implicit assumption about what data was passed to the `idv` @@ -49,10 +51,10 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i switch (type) { case TSE_SOME_ID: - return TreeElementID::createFromID(legacy_te, id); + return TreeElementID::createFromID(legacy_te, *static_cast<ID *>(idv)); case TSE_ANIM_DATA: return std::make_unique<TreeElementAnimData>(legacy_te, - *reinterpret_cast<IdAdtTemplate &>(id).adt); + *reinterpret_cast<IdAdtTemplate *>(idv)->adt); case TSE_DRIVER_BASE: return std::make_unique<TreeElementDriverBase>(legacy_te, *static_cast<AnimData *>(idv)); case TSE_NLA: @@ -70,7 +72,7 @@ std::unique_ptr<AbstractTreeElement> AbstractTreeElement::createFromType(const i case TSE_SCENE_OBJECTS_BASE: return std::make_unique<TreeElementSceneObjectsBase>(legacy_te, *static_cast<Scene *>(idv)); case TSE_LIBRARY_OVERRIDE_BASE: - return std::make_unique<TreeElementOverridesBase>(legacy_te, id); + return std::make_unique<TreeElementOverridesBase>(legacy_te, *static_cast<ID *>(idv)); case TSE_LIBRARY_OVERRIDE: return std::make_unique<TreeElementOverridesProperty>( legacy_te, *static_cast<TreeElementOverridesData *>(idv)); |