Fix error when dragging non-resource file

This commit is contained in:
Lindo
2025-07-15 22:28:38 +02:00
parent 1d8e738499
commit 529a5a3512

View File

@ -737,11 +737,13 @@ bool EditorResourcePicker::_is_drop_valid(const Dictionary &p_drag_data) const {
} else if (drag_data.has("type") && String(drag_data["type"]) == "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 (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]);
}
}
}
_ensure_allowed_types();
HashSet<StringName> allowed_types = allowed_types_with_convert;