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>
This commit is contained in:
Ben Clayton 2021-05-07 14:15:14 +00:00 committed by Commit Bot service account
parent 698d01383c
commit 33d0f6aa08
1 changed files with 1 additions and 1 deletions

View File

@ -4033,7 +4033,7 @@ ast::StorageClass FunctionEmitter::GetStorageClassForPointerValue(uint32_t id) {
const auto type_id = def_use_mgr_->GetDef(id)->type_id(); const auto type_id = def_use_mgr_->GetDef(id)->type_id();
if (type_id) { if (type_id) {
auto* ast_type = parser_impl_.ConvertType(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(); return ptr->storage_class();
} }
} }