Skip to content

Commit aa147b7

Browse files
committed
Merge pull request godotengine#90664 from KoBeWi/shadowdropped_resource
Prevent crash when dropping Resource that can't load
2 parents 53bd0d5 + 64eff14 commit aa147b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

editor/plugins/script_text_editor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,11 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
18691869

18701870
if (drop_modifier_pressed && ResourceLoader::exists(path)) {
18711871
Ref<Resource> resource = ResourceLoader::load(path);
1872+
if (resource.is_null()) {
1873+
// Resource exists, but failed to load. We need only path and name, so we can use a dummy Resource instead.
1874+
resource.instantiate();
1875+
resource->set_path_cache(path);
1876+
}
18721877
text_to_drop += _get_dropped_resource_line(resource, is_empty_line);
18731878
} else {
18741879
text_to_drop += _quote_drop_data(path);

0 commit comments

Comments
 (0)