Skip to content

Commit 4d3e564

Browse files
committed
Add self reference check to copy assignment
1 parent cf5961e commit 4d3e564

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/Wave.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,14 @@ class Wave : public ::Wave {
7171
}
7272

7373
Wave& operator=(const Wave& other) {
74+
if (&other != this) {
75+
return *this;
76+
}
77+
7478
Unload();
7579
set(other.Copy());
80+
81+
return *this;
7682
};
7783

7884
Wave& operator=(Wave&& other) {

0 commit comments

Comments
 (0)