Archived
1
Fork 0

Protect against self-assignment in AssetPtr

This commit is contained in:
Joshua Goins 2022-02-21 00:11:43 -05:00
parent cc49340cd9
commit f71fda776d

View file

@ -29,11 +29,13 @@ struct AssetPtr {
}
AssetPtr& operator=(const AssetPtr& rhs) {
handle = rhs.handle;
block = rhs.block;
if(&rhs != this) {
handle = rhs.handle;
block = rhs.block;
if(block != nullptr)
block->references++;
if (block != nullptr)
block->references++;
}
return *this;
}