Ver Fonte

* avoid range check errors for empty ansistrings written/read from ppus

git-svn-id: trunk@18253 -
florian há 14 anos atrás
pai
commit
275c6092e5
1 ficheiros alterados com 9 adições e 3 exclusões
  1. 9 3
      compiler/ppu.pas

+ 9 - 3
compiler/ppu.pas

@@ -947,8 +947,13 @@ begin
      error:=true;
      exit;
    end;
-  SetLength(Result,l);
-  ReadData(result[1],l);
+  if l>0 then
+    begin
+      SetLength(Result,l);
+      ReadData(result[1],l);
+    end
+  else
+    Result:='';
   inc(entryidx,l);
 end;
 
@@ -1311,7 +1316,8 @@ procedure tppufile.putansistring(const s: ansistring);
   begin
     l:=length(s);
     putdata(l,4);
-    putdata(s[1],l);
+    if l>0 then
+      putdata(s[1],l);
   end;