Fix DetachedBuffer self move assignment 96/216796/1
authorMichal Bloch <m.bloch@samsung.com>
Wed, 18 Sep 2019 09:38:09 +0000 (11:38 +0200)
committersanghyeok oh <sanghyeok.oh@samsung.com>
Fri, 1 Nov 2019 08:05:13 +0000 (08:05 +0000)
Change-Id: I7d107ac767bbb9982bf773eca86f827fce8c6423
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
(cherry picked from commit baba460bf65e66e62533d4a0c5e7dd7526a435ae)

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_;