mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
This commit is contained in:
@ -86,8 +86,10 @@ APE::Item::~Item()
|
||||
|
||||
Item &APE::Item::operator=(const Item &item)
|
||||
{
|
||||
delete d;
|
||||
d = new ItemPrivate(*item.d);
|
||||
if(&item != this) {
|
||||
delete d;
|
||||
d = new ItemPrivate(*item.d);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user