diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-07-23 18:19:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-23 18:19:43 +0200 |
commit | d17201afc2fd8e0ff246403041691b4ce4bcc3b5 (patch) | |
tree | f1497138bc15a2e477778a81b503ed2a7039143b | |
parent | 8cddd3b2c04aceb040b8e862ec1bae904b6842e6 (diff) | |
parent | 2846dbf239128baced33a9d5ecd18ef04b51a142 (diff) |
Merge pull request #50777 from KoBeWi/Schrödinger's-Label
Don't set metadata_label font if it doesn't exist
-rw-r--r-- | editor/plugins/texture_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/texture_editor_plugin.h | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 2eee9b8de3..44db06bcfd 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -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; diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h index c7272c83bc..36a5513ea6 100644 --- a/editor/plugins/texture_editor_plugin.h +++ b/editor/plugins/texture_editor_plugin.h @@ -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); |