Fix T85027: Crash dragging a collection over empty Outliner

Filtering may make the Outliner tree empty. The function to find the drop
element should just return null then and let the caller decide how to deal with
it.
This commit is contained in:
Julian Eisel
2021-01-25 14:34:57 +01:00
parent f226687bb9
commit 5c490bcbc8

View File

@@ -140,6 +140,11 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
TreeElement *te_hovered;
float view_mval[2];
/* Emtpy tree, e.g. while filtered. */
if (BLI_listbase_is_empty(&space_outliner->tree)) {
return NULL;
}
UI_view2d_region_to_view(
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
te_hovered = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);