From 9321e9fa86180d2bbdca6c32abc97ace9ae7ebc1 Mon Sep 17 00:00:00 2001 From: Qiqi Wu <1258552199@qq.com> Date: Sun, 18 Jun 2023 13:08:06 +0800 Subject: [PATCH] fix TexturePreview crash from an invalid image --- editor/plugins/texture_editor_plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 283e906052..1a9e09f3b1 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -160,6 +160,8 @@ void EditorInspectorPluginTexture::parse_begin(Object *p_object) { if (texture.is_null()) { Ref image(Object::cast_to(p_object)); texture = ImageTexture::create_from_image(image); + + ERR_FAIL_COND_MSG(texture == nullptr, "Failed to create the texture from an invalid image."); } add_custom_control(memnew(TexturePreview(texture, true)));