浏览代码

fix TexturePreview crash from an invalid image

Qiqi Wu 2 年之前
父节点
当前提交
9321e9fa86
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      editor/plugins/texture_editor_plugin.cpp

+ 2 - 0
editor/plugins/texture_editor_plugin.cpp

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