summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-12-18 09:31:26 +0100
committerGitHub <noreply@github.com>2021-12-18 09:31:26 +0100
commit9f5045f70f3d34735074651d951d5c219b163ed3 (patch)
tree385c8779aae25319f107db3acb1adb7e91d5d072
parentb0e93711b36bae3d2bb3a7e9a4a88faf055499fb (diff)
parentccb701f2f79473b8d2881888bd22d7e9f2c2587e (diff)
Merge pull request #56041 from Zylann/null_checks2
Fix crash if font fails loading when generating a preview
-rw-r--r--editor/plugins/editor_preview_plugins.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp
index ed1194efce..f7ec0f8c5c 100644
--- a/editor/plugins/editor_preview_plugins.cpp
+++ b/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 {
RES res = ResourceLoader::load(p_path);
+ ERR_FAIL_COND_V(res.is_null(), Ref<Texture2D>());
Ref<Font> sampled_font;
if (res->is_class("Font")) {
sampled_font = res->duplicate();