Fix T75471: Outliner: crash selecting modifier objects/targets that are in a excluded collection

There is no garuantee 'outliner_find_id()' can find those corresponding
TreeElements, safeguard against failure now.

note: not sure why this was no problem in Release builds? (could only
reproduce crashes in Debug builds...)

Maniphest Tasks: T75471

Differential Revision: https://developer.blender.org/D7365
This commit is contained in:
Philipp Oeser 2020-04-07 12:59:46 +02:00
parent 5e0465e4ec
commit 3a65397473
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #75471, Crash, outliner: when I try to select curve in modifier, when curve is excluded in another collection
Referenced by issue #75378, Blender 2.83 Alpha crashes on clicking an appended proxy object part with ghost icon in the outliner
1 changed files with 7 additions and 2 deletions

View File

@ -312,6 +312,7 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
Scene *sce;
Base *base;
Object *ob = NULL;
TreeElement *te_ob = NULL;
/* if id is not object, we search back */
if (te->idcode == ID_OB) {
@ -355,8 +356,12 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
}
}
parent_tselem = TREESTORE(outliner_find_id(soops, &soops->tree, (ID *)ob));
if (base) {
te_ob = outliner_find_id(soops, &soops->tree, (ID *)ob);
if (te_ob != NULL) {
parent_tselem = TREESTORE(te_ob);
}
if (!ELEM(NULL, parent_tselem, base)) {
if (set == OL_SETSEL_EXTEND) {
/* swap select */
if (base->flag & BASE_SELECTED) {