summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-04-02 20:20:55 +0200
committerGitHub <noreply@github.com>2021-04-02 20:20:55 +0200
commit9859f6d147845f94dc9ed3f9aeaed66150c3f2ad (patch)
tree5ff428ad95f3ca5dc0e06beb46c0144c953229dd
parent86108679b39c9f04b638d47ec07c0345515b83a2 (diff)
parent400843c1721585021b2cd320f5db13adaa6bc955 (diff)
Merge pull request #47576 from jmb462/fix-classDB-class_get_property-crash
Fix crash on null object in ClassDB.get_property() and set_property() (Fix #47573)
-rw-r--r--core/object/class_db.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index 375ad8fae1..fb7eb42738 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -1095,6 +1095,8 @@ bool ClassDB::get_property_info(StringName p_class, StringName p_property, Prope
}
bool ClassDB::set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid) {
+ ERR_FAIL_NULL_V(p_object, false);
+
ClassInfo *type = classes.getptr(p_object->get_class_name());
ClassInfo *check = type;
while (check) {
@@ -1142,6 +1144,8 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const
}
bool ClassDB::get_property(Object *p_object, const StringName &p_property, Variant &r_value) {
+ ERR_FAIL_NULL_V(p_object, false);
+
ClassInfo *type = classes.getptr(p_object->get_class_name());
ClassInfo *check = type;
while (check) {