Don't set metadata_label font if it doesn't exist

This commit is contained in:
kobewi 2021-07-23 16:29:49 +02:00
parent 8cddd3b2c0
commit 2846dbf239
2 changed files with 7 additions and 5 deletions

View file

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

View file

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