Fix T60248: Crash duplicating collections

This commit is contained in:
Campbell Barton 2019-01-14 15:36:12 +11:00
parent 65b82e09d9
commit af4ab8c6a1
Notes: blender-bot 2023-02-14 04:10:16 +01:00
Referenced by issue #60248, Pressing shift+D while in the outliner window when selecting an object causes Blender 2.8 to shut down immediately
1 changed files with 6 additions and 1 deletions

View File

@ -441,7 +441,12 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
TreeElement *te = outliner_active_collection(C);
BLI_assert(te != NULL);
/* Can happen when calling from a key binding. */
if (te == NULL) {
BKE_report(op->reports, RPT_ERROR, "No active collection");
return OPERATOR_CANCELLED;
}
Collection *collection = outliner_collection_from_tree_element(te);
Collection *parent = (te->parent) ? outliner_collection_from_tree_element(te->parent) : NULL;