ソースを参照

Merge pull request #108645 from Changryy/check-resource-before-load

Fix error when dragging non-resource file
Thaddeus Crews 1 ヶ月 前
コミット
74ee47e31e
1 ファイル変更4 行追加2 行削除
  1. 4 2
      editor/inspector/editor_resource_picker.cpp

+ 4 - 2
editor/inspector/editor_resource_picker.cpp

@@ -737,9 +737,11 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
 	} else if (drag_data.has("type") && String(drag_data["type"]) == "files") {
 	} else if (drag_data.has("type") && String(drag_data["type"]) == "files") {
 		Vector<String> files = drag_data["files"];
 		Vector<String> files = drag_data["files"];
 
 
-		// TODO: Extract the typename of the dropped filepath's resource in a more performant way, without fully loading it.
 		if (files.size() == 1) {
 		if (files.size() == 1) {
-			res = ResourceLoader::load(files[0]);
+			if (ResourceLoader::exists(files[0])) {
+				// TODO: Extract the typename of the dropped filepath's resource in a more performant way, without fully loading it.
+				res = ResourceLoader::load(files[0]);
+			}
 		}
 		}
 	}
 	}