Skip to content

Commit

Permalink
Fix EditorFileSystem crash when fetching icons for unknown file types
Browse files Browse the repository at this point in the history
Fixes crash reported in godotengine#97421 (comment).
  • Loading branch information
akien-mga authored and jss2a98aj committed Dec 10, 2024
1 parent bac4bf5 commit cad4324
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,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;
Expand Down

0 comments on commit cad4324

Please sign in to comment.