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:
authorCampbell Barton <ideasman42@gmail.com>2019-07-02 01:44:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-02 01:45:28 +0300
commit4f321a33739cdb43c3325696d5853cb251e45b1c (patch)
treeab4c905b2ea70ee134cf66e68b5b7a0c659ef835 /source/blender/editors
parent5892233319baf07cc37430dce4014b1394f57f66 (diff)
Fix crash unlinking non-ID types in the outliner
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index e1e7bf49606..a618f8ef4c2 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -288,31 +288,33 @@ static void unlink_object_cb(bContext *C,
TreeStoreElem *tselem,
void *UNUSED(user_data))
{
- Main *bmain = CTX_data_main(C);
- Object *ob = (Object *)tselem->id;
+ if (tsep && tsep->id) {
+ Main *bmain = CTX_data_main(C);
+ Object *ob = (Object *)tselem->id;
- if (GS(tsep->id->name) == ID_OB) {
- /* Parented objects need to find which collection to unlink from. */
- TreeElement *te_parent = te->parent;
- while (tsep && GS(tsep->id->name) == ID_OB) {
- te_parent = te_parent->parent;
- tsep = te_parent ? TREESTORE(te_parent) : NULL;
+ if (GS(tsep->id->name) == ID_OB) {
+ /* Parented objects need to find which collection to unlink from. */
+ TreeElement *te_parent = te->parent;
+ while (tsep && GS(tsep->id->name) == ID_OB) {
+ te_parent = te_parent->parent;
+ tsep = te_parent ? TREESTORE(te_parent) : NULL;
+ }
}
- }
- if (tsep) {
- if (GS(tsep->id->name) == ID_GR) {
- Collection *parent = (Collection *)tsep->id;
- BKE_collection_object_remove(bmain, parent, ob, true);
- DEG_id_tag_update(&parent->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- }
- else if (GS(tsep->id->name) == ID_SCE) {
- Scene *scene = (Scene *)tsep->id;
- Collection *parent = BKE_collection_master(scene);
- BKE_collection_object_remove(bmain, parent, ob, true);
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
+ if (tsep && tsep->id) {
+ if (GS(tsep->id->name) == ID_GR) {
+ Collection *parent = (Collection *)tsep->id;
+ BKE_collection_object_remove(bmain, parent, ob, true);
+ DEG_id_tag_update(&parent->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ }
+ else if (GS(tsep->id->name) == ID_SCE) {
+ Scene *scene = (Scene *)tsep->id;
+ Collection *parent = BKE_collection_master(scene);
+ BKE_collection_object_remove(bmain, parent, ob, true);
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ }
}
}
}