From ae2bc66eaee87bf27b6da775672b5a9737e44f64 Mon Sep 17 00:00:00 2001 From: davidh Date: Wed, 12 May 2021 14:32:36 -0500 Subject: [PATCH] Check for valid DynamicFontData before duplicate --- editor/plugins/editor_preview_plugins.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index ff58ba56925..5c66cc89355 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -830,7 +830,9 @@ Ref EditorFontPreviewPlugin::generate_from_path(const String &p_path, c sampled_font.instance(); if (res->is_class("DynamicFont")) { Ref font = res; - sampled_font->set_font_data(font->get_font_data()->duplicate()); + if (font->get_font_data().is_valid()) { + sampled_font->set_font_data(font->get_font_data()->duplicate()); + } for (int i = 0; i < font->get_fallback_count(); i++) { sampled_font->add_fallback(font->get_fallback(i)->duplicate()); }