summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-10-14 13:13:20 +0200
committerGitHub <noreply@github.com>2022-10-14 13:13:20 +0200
commitdfdca6300f7ce5163b438d7b133874b88ce2243c (patch)
tree628d8da03a57cbedf019134c0a34fd3b0542e598 /scene/gui
parentbd4fddd89fbb1d91c6a980a1457959f043618c8c (diff)
parent4b1937c73f432d4e775527dac1387d4a4987674a (diff)
Merge pull request #67389 from bruvzg/le_no_spam
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/line_edit.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 36e85b5d02..65670b7786 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -2175,6 +2175,12 @@ void LineEdit::_emit_text_change() {
}
void LineEdit::_shape() {
+ const Ref<Font> &font = theme_cache.font;
+ int font_size = theme_cache.font_size;
+ if (font.is_null()) {
+ return;
+ }
+
Size2 old_size = TS->shaped_text_get_size(text_rid);
TS->shaped_text_clear(text_rid);
@@ -2197,9 +2203,6 @@ void LineEdit::_shape() {
}
TS->shaped_text_set_preserve_control(text_rid, draw_control_chars);
- const Ref<Font> &font = theme_cache.font;
- int font_size = theme_cache.font_size;
- ERR_FAIL_COND(font.is_null());
TS->shaped_text_add_string(text_rid, t, font->get_rids(), font_size, font->get_opentype_features(), language);
for (int i = 0; i < TextServer::SPACING_MAX; i++) {
TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i)));