summaryrefslogtreecommitdiff
path: root/modules/text_server_adv/text_server_adv.cpp
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-10 12:19:29 +0200
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-01-10 12:19:29 +0200
commitaf6758e008ea3b1284145bda5466db28492a8139 (patch)
treeea4719df3d3a8ede5af66082e992fb9c1740dcda /modules/text_server_adv/text_server_adv.cpp
parentd7464757084099765dee5755b21a8847f4226360 (diff)
Fix freezes when tab is zero or negative width.
Diffstat (limited to 'modules/text_server_adv/text_server_adv.cpp')
-rw-r--r--modules/text_server_adv/text_server_adv.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index d82e21581c..130af1a171 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -3668,6 +3668,12 @@ float TextServerAdvanced::shaped_text_tab_align(RID p_shaped, const PackedFloat3
const_cast<TextServerAdvanced *>(this)->shaped_text_update_breaks(p_shaped);
}
+ for (int i = 0; i < p_tab_stops.size(); i++) {
+ if (p_tab_stops[i] <= 0) {
+ return 0.f;
+ }
+ }
+
int tab_index = 0;
float off = 0.f;