aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrResourceKey.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h
index d500a65657..15d7b439f1 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;
}