浏览代码

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

git-svn-id: trunk@24733 -
Károly Balogh 12 年之前
父节点
当前提交
76d7527909
共有 1 个文件被更改,包括 5 次插入0 次删除
  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;