Merge pull request #48694 from hlfstr/3.x

Check for valid DynamicFontData before duplicate in Editor
This commit is contained in:
Rémi Verschelde 2021-05-13 21:12:24 +02:00 committed by GitHub
commit b14d809fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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