tint/resolver: Fix null-deref

Materialize() can return nullptr, if there's an error.
Check the returned pointer for nullptr, before continuing on to using the pointer.

Bug: chromium:1341313
Change-Id: Ib7c9e593fbf2bb4374305c341c2b04e34e7487e9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95761
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton 2022-07-07 16:56:21 +00:00 committed by Dawn LUCI CQ
parent 808f616762
commit 89bdea0f77
1 changed files with 3 additions and 0 deletions

View File

@ -456,6 +456,9 @@ sem::Variable* Resolver::Const(const ast::Const* c, bool is_global) {
if (ty) {
// If an explicit type was specified, materialize to that type
rhs = Materialize(rhs, ty);
if (!rhs) {
return nullptr;
}
} else {
// If no type was specified, infer it from the RHS
ty = rhs->Type();