Merge pull request #97491 from akien-mga/fix-filesystem-invalid-icon-crash

Fix EditorFileSystem crash when fetching icons for unknown file types
This commit is contained in:
Rémi Verschelde 2024-09-26 18:45:56 +02:00
commit b181ff28e8
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 1 deletions

View File

@ -1978,7 +1978,10 @@ void EditorFileSystem::_update_file_icon_path(EditorFileSystemDirectory::FileInf
}
if (icon_path.is_empty() && !file_info->type.is_empty()) {
icon_path = EditorNode::get_singleton()->get_class_icon(file_info->type)->get_path();
Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(file_info->type);
if (icon.is_valid()) {
icon_path = icon->get_path();
}
}
file_info->icon_path = icon_path;