Skip to content

Commit b0dc2b4

Browse files
committed
Merge pull request #107630 from gongpha/crash!-generating-thumbnails-for-invalid-scenes
Add null check on generating thumbnails for PackedScene
2 parents c825fcf + d36a3e5 commit b0dc2b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

editor/plugins/editor_preview_plugins.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ Ref<Texture2D> EditorPackedScenePreviewPlugin::generate_from_path(const String &
342342

343343
Node *p_scene = pack->instantiate(); // The instantiated preview scene
344344

345+
if (!p_scene) {
346+
print_error(vformat("Failed to generate scene thumbnail for %s : Failed to instantiate scene", p_path));
347+
return Ref<Texture2D>();
348+
}
349+
345350
// Prohibit Viewport class as root when generating thumbnails
346351
if (Object::cast_to<Viewport>(p_scene)) {
347352
p_scene->queue_free();

0 commit comments

Comments
 (0)