Protect against self-assignment in AssetPtr
This commit is contained in:
parent
cc49340cd9
commit
f71fda776d
1 changed files with 6 additions and 4 deletions
|
@ -29,11 +29,13 @@ struct AssetPtr {
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetPtr& operator=(const AssetPtr& rhs) {
|
AssetPtr& operator=(const AssetPtr& rhs) {
|
||||||
handle = rhs.handle;
|
if(&rhs != this) {
|
||||||
block = rhs.block;
|
handle = rhs.handle;
|
||||||
|
block = rhs.block;
|
||||||
|
|
||||||
if(block != nullptr)
|
if (block != nullptr)
|
||||||
block->references++;
|
block->references++;
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue