From 33d0f6aa084072dffd06146374e6e96317a231c3 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 7 May 2021 14:15:14 +0000 Subject: [PATCH] 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 Reviewed-by: Antonio Maiorano Commit-Queue: Ben Clayton --- src/reader/spirv/function.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index 523c370ddf..1cbbc34e2b 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -4033,7 +4033,7 @@ ast::StorageClass FunctionEmitter::GetStorageClassForPointerValue(uint32_t id) { 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()) { + if (auto* ptr = As(ast_type)) { return ptr->storage_class(); } }