fix(CppUnit): TestCase::run(): check if callback is non-empty before calling it

This commit is contained in:
Günter Obiltschnig 2024-11-28 08:39:23 +01:00
parent e732c50f96
commit 0930a0db3b

View File

@ -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 (...)