mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Fixed bug that caused creating 0-length arrays to crash
Change-Id: Ibb0da5b57a2f63804c071863d8c60b845e0aece7 Tested: on Windows
This commit is contained in:
@@ -498,10 +498,9 @@ class FlatBufferBuilder {
|
||||
template<typename T> Offset<Vector<T>> CreateVector(const T *v, size_t len) {
|
||||
NotNested();
|
||||
StartVector(len, sizeof(T));
|
||||
auto i = len;
|
||||
do {
|
||||
for (auto i = len; i > 0; ) {
|
||||
PushElement(v[--i]);
|
||||
} while (i);
|
||||
}
|
||||
return Offset<Vector<T>>(EndVector(len));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user