Index: include/gpu/GrResourceKey.h |
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h |
index d500a65657923f4ca2fa304075d5432655c1db8a..15d7b439f10827d7a1fd479987b94d7947cba705 100644 |
--- a/include/gpu/GrResourceKey.h |
+++ b/include/gpu/GrResourceKey.h |
@@ -49,10 +49,12 @@ protected: |
} |
GrResourceKey& operator=(const GrResourceKey& that) { |
- size_t bytes = that.size(); |
- SkASSERT(SkIsAlign4(bytes)); |
- fKey.reset(SkToInt(bytes / sizeof(uint32_t))); |
- memcpy(fKey.get(), that.fKey.get(), bytes); |
+ if (this != &that) { |
+ size_t bytes = that.size(); |
+ SkASSERT(SkIsAlign4(bytes)); |
+ fKey.reset(SkToInt(bytes / sizeof(uint32_t))); |
+ memcpy(fKey.get(), that.fKey.get(), bytes); |
+ } |
return *this; |
} |