From c54c1b0b6b439bfb35dcd99fc3c2da342f03ddd2 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 9 Jun 2022 20:19:27 +0200 Subject: [PATCH] Fix infinite loop when calling `Control.popup_centered_minsize()` Co-authored-by: sriramun (cherry picked from commit 08e804b3b718862e92e6b296b914e3829e43717e) --- scene/gui/control.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 9867b5aaf8c..029a215588b 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -172,6 +172,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; minimum_size_changed(); }