Fixed DetachedBuffer self move assignment (#5521)
authormmoscicki2 <50666212+mmoscicki2@users.noreply.github.com>
Thu, 19 Sep 2019 17:32:24 +0000 (19:32 +0200)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 19 Sep 2019 17:32:24 +0000 (10:32 -0700)
include/flatbuffers/flatbuffers.h

index 46457bd..253af15 100644 (file)
@@ -638,6 +638,9 @@ class DetachedBuffer {
   #if !defined(FLATBUFFERS_CPP98_STL)
   // clang-format on
   DetachedBuffer &operator=(DetachedBuffer &&other) {
+    if (this == &other)
+      return *this;
+
     destroy();
 
     allocator_ = other.allocator_;