Browse Source

also return nil for the empty env vars in the generic implementation in GetEnvPChar

git-svn-id: trunk@24733 -
Károly Balogh 12 years ago
parent
commit
76d7527909
1 changed files with 5 additions and 0 deletions
  1. 5 0
      compiler/globals.pas

+ 5 - 0
compiler/globals.pas

@@ -902,6 +902,11 @@ implementation
         {$undef GETENVOK}
         {$undef GETENVOK}
       {$else}
       {$else}
         GetEnvPchar:=StrPNew(GetEnvironmentVariable(envname));
         GetEnvPchar:=StrPNew(GetEnvironmentVariable(envname));
+        if (length(GetEnvPChar)=0) then 
+          begin
+            FreeEnvPChar(GetEnvPChar);
+            GetEnvPChar:=nil;
+          end;
       {$endif}
       {$endif}
       end;
       end;