Просмотр исходного кода

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

Avoids doing work that doesn't need to be done.
Lioncash 8 лет назад
Родитель
Сommit
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) {
+        if (this == &o) {
+            return *this;
+        }
         if (!empty()) {
             if (!o.empty()) {
                 object = o.object;