Merge pull request #56041 from Zylann/null_checks2

Fix crash if font fails loading when generating a preview
This commit is contained in:
Rémi Verschelde 2021-12-18 09:31:26 +01:00 committed by GitHub
commit 9f5045f70f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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