瀏覽代碼

Merge pull request #61855 from Calinou/popup-centered-minsize-fix-freeze

Fix infinite loop when calling `Control.popup_centered_minsize()`
Rémi Verschelde 2 年之前
父節點
當前提交
92dfa7901b
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      scene/gui/control.cpp

+ 6 - 0
scene/gui/control.cpp

@@ -1563,6 +1563,12 @@ void Control::set_custom_minimum_size(const Size2 &p_custom) {
 	if (p_custom == data.custom_minimum_size) {
 		return;
 	}
+
+	if (isnan(p_custom.x) || isnan(p_custom.y)) {
+		// Prevent infinite loop.
+		return;
+	}
+
 	data.custom_minimum_size = p_custom;
 	update_minimum_size();
 }