Merge pull request #48694 from hlfstr/3.x
Check for valid DynamicFontData before duplicate in Editor
This commit is contained in:
commit
b14d809fa3
1 changed files with 3 additions and 1 deletions
|
@ -830,7 +830,9 @@ Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, c
|
||||||
sampled_font.instance();
|
sampled_font.instance();
|
||||||
if (res->is_class("DynamicFont")) {
|
if (res->is_class("DynamicFont")) {
|
||||||
Ref<DynamicFont> font = res;
|
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++) {
|
for (int i = 0; i < font->get_fallback_count(); i++) {
|
||||||
sampled_font->add_fallback(font->get_fallback(i)->duplicate());
|
sampled_font->add_fallback(font->get_fallback(i)->duplicate());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue