From 97f3aa91746a7d207513a73725e92cee7c35bb87 Mon Sep 17 00:00:00 2001 From: mmoscicki2 <50666212+mmoscicki2@users.noreply.github.com> Date: Thu, 19 Sep 2019 19:32:24 +0200 Subject: [PATCH] Fixed DetachedBuffer self move assignment (#5521) --- include/flatbuffers/flatbuffers.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index 46457bd31..253af1552 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -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_;