From a83ea6b57ddbfbce656cd47a6d21cd6a13c37d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 26 Sep 2024 15:52:39 +0200 Subject: [PATCH] Fix EditorFileSystem crash when fetching icons for unknown file types Fixes crash reported in https://github.com/godotengine/godot/pull/97421#issuecomment-2376684690. --- editor/editor_file_system.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index bc46d018922..afa0548044f 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -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 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;