From 400843c1721585021b2cd320f5db13adaa6bc955 Mon Sep 17 00:00:00 2001 From: jmb462 Date: Fri, 2 Apr 2021 20:05:01 +0200 Subject: fix crash on null class in ClassDB.get_property() and set_property() --- core/object/class_db.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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) { -- cgit v1.2.3