Skip to content

Commit e5256e7

Browse files
committed
Guard CpyCtor when other == this
1 parent f7786dd commit e5256e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

csrc/fusion.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,11 @@ Fusion::Fusion(Fusion&& other) : Fusion() {
327327
// Copy Assignment -- shares the source's container
328328
Fusion& Fusion::operator=(const Fusion& other) {
329329
FUSER_PERF_SCOPE("Fusion copy assign");
330-
Fusion copy(other);
331-
clear();
332-
swap(*this, copy);
330+
if (this != &other) {
331+
Fusion copy(other);
332+
clear();
333+
swap(*this, copy);
334+
}
333335
return *this;
334336
}
335337

0 commit comments

Comments
 (0)