Переглянути джерело

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

Avoids doing work that doesn't need to be done.
Lioncash 8 роки тому
батько
коміт
36e60c217a
1 змінених файлів з 3 додано та 0 видалено
  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) {
     ResultVal& operator=(const ResultVal& o) {
+        if (this == &o) {
+            return *this;
+        }
         if (!empty()) {
         if (!empty()) {
             if (!o.empty()) {
             if (!o.empty()) {
                 object = o.object;
                 object = o.object;