Răsfoiți Sursa

result: Check against self-assignment in ResultVal's copy assignment operator

Avoids doing work that doesn't need to be done.
Lioncash 8 ani în urmă
părinte
comite
36e60c217a
1 a modificat fișierele cu 3 adăugiri și 0 ștergeri
  1. 3 0
      src/core/hle/result.h

+ 3 - 0
src/core/hle/result.h

@@ -200,6 +200,9 @@ public:
     }
 
     ResultVal& operator=(const ResultVal& o) {
+        if (this == &o) {
+            return *this;
+        }
         if (!empty()) {
             if (!o.empty()) {
                 object = o.object;