瀏覽代碼

+ Added check for nil buffer to setstring

michael 23 年之前
父節點
當前提交
aae8314d02
共有 2 個文件被更改,包括 12 次插入4 次删除
  1. 6 2
      rtl/inc/astrings.inc
  2. 6 2
      rtl/inc/sstrings.inc

+ 6 - 2
rtl/inc/astrings.inc

@@ -795,7 +795,8 @@ Procedure SetString (Var S : AnsiString; Buf : PChar; Len : Longint);
 
 begin
   SetLength(S,Len);
-  Move (Buf[0],S[1],Len);
+  If Buf<>Nil then
+    Move (Buf[0],S[1],Len);
 end;
 
 
@@ -821,7 +822,10 @@ end;
 
 {
   $Log$
-  Revision 1.30  2002-10-17 12:43:00  florian
+  Revision 1.31  2002-10-19 17:06:50  michael
+  + Added check for nil buffer to setstring
+
+  Revision 1.30  2002/10/17 12:43:00  florian
     + ansistring_append* implemented
 
   Revision 1.29  2002/10/02 18:21:51  peter

+ 6 - 2
rtl/inc/sstrings.inc

@@ -672,13 +672,17 @@ end;
 
 Procedure SetString (Var S : Shortstring; Buf : PChar; Len : Longint);
 begin
-  Move (Buf[0],S[1],Len);
+  If Buf<>Nil then
+    Move (Buf[0],S[1],Len);
   S[0]:=chr(len);
 end;
 
 {
   $Log$
-  Revision 1.24  2002-10-02 18:21:51  peter
+  Revision 1.25  2002-10-19 17:06:50  michael
+  + Added check for nil buffer to setstring
+
+  Revision 1.24  2002/10/02 18:21:51  peter
     * Copy() changed to internal function calling compilerprocs
     * FPC_SHORTSTR_COPY renamed to FPC_SHORTSTR_ASSIGN because of the
       new copy functions