Skip to content

Commit a3f5035

Browse files
authored
Merge pull request #1960 from Naros/GH-1959
Do not clear variant on assignment to self
2 parents 9ae37ac + d648ec6 commit a3f5035

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/variant/variant.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ Object *Variant::get_validated_object() const {
536536
}
537537

538538
Variant &Variant::operator=(const Variant &other) {
539+
if (unlikely(this == &other)) {
540+
return *this;
541+
}
542+
539543
clear();
540544
::godot::gdextension_interface::variant_new_copy(_native_ptr(), other._native_ptr());
541545
return *this;

0 commit comments

Comments
 (0)