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:
parent
73c58010c7
commit
17a8498982
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue