1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

fix TexturePreview crash from an invalid image

This commit is contained in:
Qiqi Wu
2023-06-18 13:08:06 +08:00
parent a83eb16fba
commit 9321e9fa86

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)));