You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
fix TexturePreview crash from an invalid image
This commit is contained in:
@@ -160,6 +160,8 @@ void EditorInspectorPluginTexture::parse_begin(Object *p_object) {
|
|||||||
if (texture.is_null()) {
|
if (texture.is_null()) {
|
||||||
Ref<Image> image(Object::cast_to<Image>(p_object));
|
Ref<Image> image(Object::cast_to<Image>(p_object));
|
||||||
texture = ImageTexture::create_from_image(image);
|
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)));
|
add_custom_control(memnew(TexturePreview(texture, true)));
|
||||||
|
|||||||
Reference in New Issue
Block a user