ソースを参照

Merge pull request #56041 from Zylann/null_checks2

Fix crash if font fails loading when generating a preview
Rémi Verschelde 3 年 前
コミット
9f5045f70f
1 ファイル変更1 行追加0 行削除
  1. 1 0
      editor/plugins/editor_preview_plugins.cpp

+ 1 - 0
editor/plugins/editor_preview_plugins.cpp

@@ -824,6 +824,7 @@ bool EditorFontPreviewPlugin::handles(const String &p_type) const {
 
 
 Ref<Texture2D> EditorFontPreviewPlugin::generate_from_path(const String &p_path, const Size2 &p_size) const {
 Ref<Texture2D> EditorFontPreviewPlugin::generate_from_path(const String &p_path, const Size2 &p_size) const {
 	RES res = ResourceLoader::load(p_path);
 	RES res = ResourceLoader::load(p_path);
+	ERR_FAIL_COND_V(res.is_null(), Ref<Texture2D>());
 	Ref<Font> sampled_font;
 	Ref<Font> sampled_font;
 	if (res->is_class("Font")) {
 	if (res->is_class("Font")) {
 		sampled_font = res->duplicate();
 		sampled_font = res->duplicate();