Fix UBSAN error
As() was being called on a nullptr object.
Change-Id: Iedd7f1c57d12f1ad5ea2af60317817841f5d1392
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50303
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc
index 523c370..1cbbc34 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -4033,7 +4033,7 @@
const auto type_id = def_use_mgr_->GetDef(id)->type_id();
if (type_id) {
auto* ast_type = parser_impl_.ConvertType(type_id);
- if (auto* ptr = ast_type->As<ast::Pointer>()) {
+ if (auto* ptr = As<ast::Pointer>(ast_type)) {
return ptr->storage_class();
}
}