Merge pull request #50777 from KoBeWi/Schrödinger's-Label

Don't set metadata_label font if it doesn't exist
This commit is contained in:
Rémi Verschelde 2021-07-23 18:19:43 +02:00 committed by GitHub
commit d17201afc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -48,8 +48,10 @@ void TexturePreview::_notification(int p_what) {
break;
}
Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), SNAME("EditorFonts"));
metadata_label->add_theme_font_override("font", metadata_label_font);
if (metadata_label) {
Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), SNAME("EditorFonts"));
metadata_label->add_theme_font_override("font", metadata_label_font);
}
checkerboard->set_texture(get_theme_icon(SNAME("Checkerboard"), SNAME("EditorIcons")));
} break;

View File

@ -39,10 +39,10 @@ class TexturePreview : public MarginContainer {
GDCLASS(TexturePreview, MarginContainer);
private:
TextureRect *texture_display;
TextureRect *texture_display = nullptr;
TextureRect *checkerboard;
Label *metadata_label;
TextureRect *checkerboard = nullptr;
Label *metadata_label = nullptr;
protected:
void _notification(int p_what);