Pārlūkot izejas kodu

ERR: Verify that getenv returned something before using it

Andy Cedilnik 21 gadi atpakaļ
vecāks
revīzija
161c31bc2b
1 mainītis faili ar 8 papildinājumiem un 1 dzēšanām
  1. 8 1
      Source/kwsys/SystemTools.cxx

+ 8 - 1
Source/kwsys/SystemTools.cxx

@@ -169,7 +169,14 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
     {
     env = "PATH";
     }
-  kwsys_stl::string pathEnv = getenv(env);
+  const char* cpathEnv = SystemTools::GetEnv(env);
+  if ( !cpathEnv )
+    {
+    return;
+    }
+
+  kwsys_stl::string pathEnv = cpathEnv;
+   
   // A hack to make the below algorithm work.  
   if(pathEnv[pathEnv.length()-1] != ':')
     {