Skip to content

Commit

Permalink
Merge pull request #47576 from jmb462/fix-classDB-class_get_property-…
Browse files Browse the repository at this point in the history
…crash

Fix crash on null object in ClassDB.get_property() and set_property() (Fix #47573)
  • Loading branch information
akien-mga authored Apr 2, 2021
2 parents 8610867 + 400843c commit 9859f6d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/object/class_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9859f6d

Please sign in to comment.