writer/hlsl: Prevent NPE on error
If the HLSL sanitizer errors, then there may be no ArrayLengthFromUniform::Result, so we check the pointer before attempting to dereference it. Bug: chromium:1273230 Change-Id: I9575d20748720623a94ac86f45da14302b20440a Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/70740 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: James Price <jrprice@google.com> Commit-Queue: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
fb3c1c4d4b
commit
066c175852
|
@ -186,9 +186,10 @@ SanitizedResult Sanitize(
|
||||||
|
|
||||||
SanitizedResult result;
|
SanitizedResult result;
|
||||||
result.program = std::move(out.program);
|
result.program = std::move(out.program);
|
||||||
result.used_array_length_from_uniform_indices =
|
if (auto* res = out.data.Get<transform::ArrayLengthFromUniform::Result>()) {
|
||||||
std::move(out.data.Get<transform::ArrayLengthFromUniform::Result>()
|
result.used_array_length_from_uniform_indices =
|
||||||
->used_size_indices);
|
std::move(res->used_size_indices);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue