summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsps1112 <sidps1112@gmail.com>2021-03-03 16:32:50 +0530
committersps1112 <sidps1112@gmail.com>2021-03-04 10:55:42 +0530
commitef1d58f034233a0d8b5d0b5dbf539e851ffc726c (patch)
treeb86bffc9832af4bbc5aaf5de808e2b14000dd1ad
parent4d1f83a621a03a42a6ab7765084db84aab32256f (diff)
Add size check in Control._edit_set_state to prevent crash
-rw-r--r--scene/gui/control.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index bff3024e38..c625d6a2f3 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -73,6 +73,10 @@ Dictionary Control::_edit_get_state() const {
}
void Control::_edit_set_state(const Dictionary &p_state) {
+ ERR_FAIL_COND((p_state.size() <= 0) ||
+ p_state["rotation"].is_null() || p_state["scale"].is_null() ||
+ p_state["pivot"].is_null() || p_state["anchors"].is_null() || p_state["offsets"].is_null());
+
Dictionary state = p_state;
set_rotation(state["rotation"]);