Check for valid DynamicFontData before duplicate

This commit is contained in:
davidh 2021-05-12 14:32:36 -05:00
parent 009a738d09
commit ae2bc66eae

View file

@ -830,7 +830,9 @@ Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, c
sampled_font.instance();
if (res->is_class("DynamicFont")) {
Ref<DynamicFont> 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());
}