Added VectorLength helper function that works on nullptr.

Change-Id: Ie62096f7337a476bee7a6d46d652e594fb3124d2
Tested: on Linux.
Bug: 18201051
This commit is contained in:
Wouter van Oortmerssen
2014-12-08 17:32:26 -08:00
parent 318668aed6
commit 8833cff911
2 changed files with 7 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ void AccessFlatBufferTest(const std::string &flatbuf) {
TEST_EQ(pos->test3().b(), 20);
auto inventory = monster->inventory();
TEST_EQ(VectorLength(inventory), 10); // Works even if inventory is null.
TEST_NOTNULL(inventory);
unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
for (auto it = inventory->begin(); it != inventory->end(); ++it)