Merge pull request #78387 from Wuqiqi123/fix_texture_preview_crash_from_invalid_image

Fix TexturePreview crash when creating an invalid image
This commit is contained in:
Rémi Verschelde 2023-06-18 16:33:27 +02:00
commit 96166c9aab
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -160,6 +160,8 @@ void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
if (texture.is_null()) {
Ref<Image> image(Object::cast_to<Image>(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)));