You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
Make freed object different than null in comparison operators
This is so everything is consistent, as a freed object is not equivalent to `null` in general. The booleanization of a freed object still returns `false` to work as an easy check for validity of objects. Similarly, the negation of a freed object returns `true`. Also makes freed objects different from each other (if they are not the same reference).
This commit is contained in:
@@ -931,7 +931,7 @@ bool Variant::is_zero() const {
|
||||
return *reinterpret_cast<const ::RID *>(_data._mem) == ::RID();
|
||||
}
|
||||
case OBJECT: {
|
||||
return _get_obj().obj == nullptr;
|
||||
return get_validated_object() == nullptr;
|
||||
}
|
||||
case CALLABLE: {
|
||||
return reinterpret_cast<const Callable *>(_data._mem)->is_null();
|
||||
|
||||
Reference in New Issue
Block a user