ObjectStorage Allocate nullptr when id is 0

Bug: chromium:1052673
Change-Id: I16e39807a48f7a2c937b2a993f3a17cc8f58eac3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16161
Commit-Queue: Natasha Lee <natlee@microsoft.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Natasha Lee 2020-02-25 19:20:15 +00:00 committed by Commit Bot service account
parent 73c58010c7
commit 17a8498982
1 changed files with 3 additions and 3 deletions

View File

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