Browse Source

BUG: Do not dereference an end iterator.

Brad King 20 years ago
parent
commit
0df3c162fb
2 changed files with 2 additions and 2 deletions
  1. 1 1
      Source/cmCTest.cxx
  2. 1 1
      Source/cmSystemTools.cxx

+ 1 - 1
Source/cmCTest.cxx

@@ -1070,7 +1070,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
     }
 
   cmsysProcess_WaitForExit(cp, 0);
-  if(output)
+  if(output && tempOutput.begin() != tempOutput.end())
     {
     output->append(&*tempOutput.begin(), tempOutput.size());
     }

+ 1 - 1
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());
     }