Skip to content

Commit

Permalink
Add a missing nullopt check.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy-g committed Mar 25, 2024
1 parent 1b56be6 commit d22cc28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backends/p4tools/modules/testgen/testgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ std::optional<AbstractTestList> generateTestsImpl(std::optional<std::string_view
compilerResultOpt = P4Tools::CompilerTarget::runCompiler();
}

if (!compilerResultOpt.has_value()) {
::error("Failed to run the compiler.");
return std::nullopt;
}

const auto *testgenCompilerResult =
compilerResultOpt.value().get().checkedTo<TestgenCompilerResult>();

Expand Down

0 comments on commit d22cc28

Please sign in to comment.