소스 검색

Fix infinite loop when calling `Control.popup_centered_minsize()`

Co-authored-by: sriramun <[email protected]>
Hugo Locurcio 3 년 전
부모
커밋
08e804b3b7
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      scene/gui/control.cpp

+ 6 - 0
scene/gui/control.cpp

@@ -206,6 +206,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();
 }