From 67b29d4e439a1726e1edcfce317d7575f6217d6f Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Thu, 7 Dec 2017 11:15:37 -0800 Subject: [PATCH] Fixed CreateStruct not testing for nesting. Change-Id: I16bf46682ad68c62b778ed1514b6b706c8cb8f6f Tested: on Linux. --- include/flatbuffers/flatbuffers.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index aa5df859f..df616f8a4 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 Offset CreateStruct(const T &structobj) { + NotNested(); Align(AlignOf()); buf_.push_small(structobj); return Offset(GetSize());