Fix DetachedBuffer self move assignment 39/214139/2
authorMichal Bloch <m.bloch@samsung.com>
Wed, 18 Sep 2019 09:38:09 +0000 (11:38 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Mon, 23 Sep 2019 02:02:14 +0000 (02:02 +0000)
Change-Id: I7d107ac767bbb9982bf773eca86f827fce8c6423
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/internal/include/flatbuffers/flatbuffers.h

index 8c87dff..8f5ae32 100644 (file)
@@ -551,6 +551,9 @@ class DetachedBuffer {
   #if !defined(FLATBUFFERS_CPP98_STL)
   // clang-format on
   DetachedBuffer &operator=(DetachedBuffer &&other) {
+    if (this == &other)
+      return *this;
+
     destroy();
 
     allocator_ = other.allocator_;