summaryrefslogtreecommitdiffstats
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-05-30 11:47:38 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-05-30 11:47:38 +0200
commitaa147b74eac36a5cf8d7abfa220e0295c1508943 (patch)
treece537079d9ef6168c84b148af859c5cad74a4a7e /editor
parent53bd0d5acfcf9a58fb2e4f1d770f87bbb189f07f (diff)
parent64eff14a460cf51c14d3166f1f87efdd7b5b434d (diff)
downloadredot-engine-aa147b74eac36a5cf8d7abfa220e0295c1508943.tar.gz
Merge pull request #90664 from KoBeWi/shadowdropped_resource
Prevent crash when dropping Resource that can't load
Diffstat (limited to 'editor')
-rw-r--r--editor/plugins/script_text_editor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 195d2a5b02..b11ad8b7d5 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -1869,6 +1869,11 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data
if (drop_modifier_pressed && ResourceLoader::exists(path)) {
Ref<Resource> resource = ResourceLoader::load(path);
+ if (resource.is_null()) {
+ // Resource exists, but failed to load. We need only path and name, so we can use a dummy Resource instead.
+ resource.instantiate();
+ resource->set_path_cache(path);
+ }
text_to_drop += _get_dropped_resource_line(resource, is_empty_line);
} else {
text_to_drop += _quote_drop_data(path);