You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Fix debugger crash inspecting freed object.
This seems to be the correct way to validate a reference. Why is cast_to failing? Is this the correct way of checking if the object is valid?
This commit is contained in:
@@ -347,13 +347,17 @@ void SceneDebuggerObject::serialize(Array &r_arr, int p_max_size) {
|
||||
const PropertyInfo &pi = properties[i].first;
|
||||
Variant &var = properties[i].second;
|
||||
|
||||
WeakRef *ref = Object::cast_to<WeakRef>(var);
|
||||
if (ref) {
|
||||
var = ref->get_ref();
|
||||
}
|
||||
|
||||
RES res = var;
|
||||
|
||||
if (var.get_type() == Variant::OBJECT && var.is_ref()) {
|
||||
REF r = var;
|
||||
if (r.is_valid()) {
|
||||
res = *r;
|
||||
} else {
|
||||
res = RES();
|
||||
}
|
||||
}
|
||||
|
||||
Array prop;
|
||||
prop.push_back(pi.name);
|
||||
prop.push_back(pi.type);
|
||||
|
||||
Reference in New Issue
Block a user