瀏覽代碼

Fix freezes when tab is zero or negative width.

bruvzg 3 年之前
父節點
當前提交
af6758e008
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 6 0
      modules/text_server_adv/text_server_adv.cpp
  2. 6 0
      modules/text_server_fb/text_server_fb.cpp

+ 6 - 0
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);
 		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;
 	int tab_index = 0;
 	float off = 0.f;
 	float off = 0.f;
 
 

+ 6 - 0
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<TextServerFallback *>(this)->shaped_text_update_breaks(p_shaped);
 		const_cast<TextServerFallback *>(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;
 	int tab_index = 0;
 	float off = 0.f;
 	float off = 0.f;