diff --git a/src/dawn_wire/server/ObjectStorage.h b/src/dawn_wire/server/ObjectStorage.h index 55d6a0962a..e98966dc4e 100644 --- a/src/dawn_wire/server/ObjectStorage.h +++ b/src/dawn_wire/server/ObjectStorage.h @@ -94,10 +94,10 @@ namespace dawn_wire { namespace server { } // Allocates the data for a given ID and returns it. - // Returns nullptr if the ID is already allocated, or too far ahead. - // Invalidates all the Data* + // Returns nullptr if the ID is already allocated, or too far ahead, or if ID is 0 (ID 0 is + // reserved for nullptr). Invalidates all the Data* Data* Allocate(uint32_t id) { - if (id > mKnown.size()) { + if (id == 0 || id > mKnown.size()) { return nullptr; }