Skip to content

Commit

Permalink
Fix unchecked optional access in compile subcommand
Browse files Browse the repository at this point in the history
  • Loading branch information
ottmar-zittlau committed Jan 5, 2025
1 parent be64b78 commit 331f3eb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions toolchain/driver/compile_subcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,17 @@ class CompilationUnit {
source_ = SourceBuffer::MakeFromFileOrStdin(*driver_env_->fs,
input_filename_, *consumer_);
});
if (mem_usage_) {
mem_usage_->Add("source_", source_->text().size(),
source_->text().size());
}

if (!source_) {
success_ = false;
return;
}

if (mem_usage_) {
mem_usage_->Add("source_", source_->text().size(),
source_->text().size());
}

CARBON_VLOG("*** SourceBuffer ***\n```\n{0}\n```\n", source_->text());

LogCall("Lex::Lex", "lex",
Expand Down

0 comments on commit 331f3eb

Please sign in to comment.