Fixed bug that caused creating 0-length arrays to crash

Change-Id: Ibb0da5b57a2f63804c071863d8c60b845e0aece7
Tested: on Windows
parent fadb71f2
...@@ -498,10 +498,9 @@ class FlatBufferBuilder { ...@@ -498,10 +498,9 @@ class FlatBufferBuilder {
template<typename T> Offset<Vector<T>> CreateVector(const T *v, size_t len) { template<typename T> Offset<Vector<T>> CreateVector(const T *v, size_t len) {
NotNested(); NotNested();
StartVector(len, sizeof(T)); StartVector(len, sizeof(T));
auto i = len; for (auto i = len; i > 0; ) {
do {
PushElement(v[--i]); PushElement(v[--i]);
} while (i); }
return Offset<Vector<T>>(EndVector(len)); return Offset<Vector<T>>(EndVector(len));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment