diff options
author | Yuri Roubinsky <chaosus89@gmail.com> | 2021-07-31 21:42:29 +0300 |
---|---|---|
committer | Yuri Roubinsky <chaosus89@gmail.com> | 2021-08-01 12:20:11 +0300 |
commit | c86aa2a705ab266cbd0942b4df1de693b00cd6a2 (patch) | |
tree | 41eb956b4b350a337f9a01bf26870ea17d08298d | |
parent | e5411a815cf3517efa2fd3dae54b1f2a5ce64b36 (diff) |
Fix crash on doc dragging in script list panel
-rw-r--r-- | editor/editor_resource_picker.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 7d809ea656..9977f5f42c 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -505,7 +505,9 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const { Ref<Resource> res; if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); - res = se->get_edited_resource(); + if (se) { + res = se->get_edited_resource(); + } } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { res = drag_data["resource"]; } @@ -571,7 +573,9 @@ void EditorResourcePicker::drop_data_fw(const Point2 &p_point, const Variant &p_ Ref<Resource> dropped_resource; if (drag_data.has("type") && String(drag_data["type"]) == "script_list_element") { ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(drag_data["script_list_element"]); - dropped_resource = se->get_edited_resource(); + if (se) { + dropped_resource = se->get_edited_resource(); + } } else if (drag_data.has("type") && String(drag_data["type"]) == "resource") { dropped_resource = drag_data["resource"]; } |