From af6758e008ea3b1284145bda5466db28492a8139 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 10 Jan 2022 12:19:29 +0200 Subject: Fix freezes when tab is zero or negative width. --- modules/text_server_adv/text_server_adv.cpp | 6 ++++++ modules/text_server_fb/text_server_fb.cpp | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'modules') 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(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; diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 1f7c5427be..a4e268d7b3 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2665,6 +2665,12 @@ float TextServerFallback::shaped_text_tab_align(RID p_shaped, const PackedFloat3 const_cast(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; -- cgit v1.2.3