diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e9e84b513..1e079b923 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1070,7 +1070,7 @@ int cmCTest::RunTest(std::vector argv, } cmsysProcess_WaitForExit(cp, 0); - if(output) + if(output && tempOutput.begin() != tempOutput.end()) { output->append(&*tempOutput.begin(), tempOutput.size()); } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0621ba22b..623a0f917 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -507,7 +507,7 @@ bool cmSystemTools::RunSingleCommand( } cmsysProcess_WaitForExit(cp, 0); - if ( output ) + if ( output && tempOutput.begin() != tempOutput.end()) { output->append(&*tempOutput.begin(), tempOutput.size()); }