Skip to content

Commit

Permalink
fix(CppUnit): TestCase::run(): check if callback is non-empty before …
Browse files Browse the repository at this point in the history
…calling it
  • Loading branch information
obiltschnig committed Nov 28, 2024
1 parent e732c50 commit 0930a0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CppUnit/src/TestCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ void TestCase::run(TestResult *result, const Test::Callback& callback)
catch (std::exception& e)
{
std::string msg(TestResult::demangle(typeid(e).name()));
msg.append(":\n").append(callback(e));
if (callback)
{
msg.append(": ").append(callback(e));
}
result->addError(this, new CppUnitException(msg));
}
catch (...)
Expand Down

0 comments on commit 0930a0d

Please sign in to comment.