ast: Fix nullptr deref in Variable::info_to_str

Varaibles can infer types now, in which case the type_ field is null.

Fixed: chromium:1221120
Change-Id: I0cb2a6a2e8128c56625f48940cf73cf4cadb22ce
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/55252
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-06-21 19:20:16 +00:00
committed by Tint LUCI CQ
parent def7313523
commit 4d94eee072
6 changed files with 36 additions and 1 deletions

View File

@@ -85,7 +85,10 @@ void Variable::info_to_str(const sem::Info& sem,
make_indent(out, indent);
out << declared_access_ << std::endl;
make_indent(out, indent);
out << type_->type_name() << std::endl;
if (type_) {
out << type_->type_name();
}
out << std::endl;
}
void Variable::constructor_to_str(const sem::Info& sem,