diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index aa5df859fd22b0a2430c078667f3a677df6d92b8..df616f8a426bee93a91f19b3ba487871893738fc 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -413,7 +413,7 @@ class DetachedBuffer { : allocator_(other.allocator_), own_allocator_(other.own_allocator_), buf_(other.buf_), reserved_(other.reserved_), cur_(other.cur_), size_(other.size_) { - other.reset(); + other.reset(); } DetachedBuffer &operator=(DetachedBuffer &&other) { @@ -1446,6 +1446,7 @@ class FlatBufferBuilder /// @brief Write a struct by itself, typically to be part of a union. template<typename T> Offset<const T *> CreateStruct(const T &structobj) { + NotNested(); Align(AlignOf<T>()); buf_.push_small(structobj); return Offset<const T *>(GetSize());