summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-12 13:51:37 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-12 13:51:37 +0100
commit92dfa7901b61e43e275e50e4c5f2f91f6d250356 (patch)
tree0b71acdfec6fa53ab6a029e456a6edba450d8e27
parente2a37295f52366ab04cbb87ecbd945dd23de9517 (diff)
parent08e804b3b718862e92e6b296b914e3829e43717e (diff)
Merge pull request #61855 from Calinou/popup-centered-minsize-fix-freeze
Fix infinite loop when calling `Control.popup_centered_minsize()`
-rw-r--r--scene/gui/control.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 50ffc0509c..68af7af5d4 100644
--- a/scene/gui/control.cpp
+++ b/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();
}