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:
parent
808f616762
commit
89bdea0f77
|
@ -456,6 +456,9 @@ sem::Variable* Resolver::Const(const ast::Const* c, bool is_global) {
|
||||||
if (ty) {
|
if (ty) {
|
||||||
// If an explicit type was specified, materialize to that type
|
// If an explicit type was specified, materialize to that type
|
||||||
rhs = Materialize(rhs, ty);
|
rhs = Materialize(rhs, ty);
|
||||||
|
if (!rhs) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If no type was specified, infer it from the RHS
|
// If no type was specified, infer it from the RHS
|
||||||
ty = rhs->Type();
|
ty = rhs->Type();
|
||||||
|
|
Loading…
Reference in New Issue