Commit 48e6f1f3 authored by Jonathan Wakely's avatar Jonathan Wakely Committed by Knut Omang
Browse files

Stop TestInfo::Run() calling a function through null pointer

If the object was never created then trying to call &Test::DeleteSelf_
will dereference a null pointer, with undefined behaviour.

Fixes #845
parent 9a502a5b
......@@ -2675,10 +2675,12 @@ void TestInfo::Run() {
test->Run();
}
if (test != NULL) {
// Deletes the test object.
impl->os_stack_trace_getter()->UponLeavingGTest();
internal::HandleExceptionsInMethodIfSupported(
test, &Test::DeleteSelf_, "the test fixture's destructor");
}
result_.set_elapsed_time(internal::GetTimeInMillis() - start);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment