From 7429c4871b157da6b80e8b9edc6a47ca8001861a Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 30 Sep 2007 11:23:33 +0000 Subject: [PATCH] * fix for 9770 git-svn-id: trunk@8689 - --- rtl/objpas/strutils.pp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtl/objpas/strutils.pp b/rtl/objpas/strutils.pp index 65c15d680d..4289447295 100644 --- a/rtl/objpas/strutils.pp +++ b/rtl/objpas/strutils.pp @@ -350,17 +350,22 @@ end; Function StuffString(const AText: string; AStart, ALength: Cardinal; const ASubText: string): string; var i,j : SizeUInt; + k : SizeInt; begin j:=length(ASubText); i:=length(AText); + if AStart>i then + aStart:=i+1; + k:=i-AStart+1; + if ALength> k then + ALength:=k; SetLength(Result,i+j-ALength); move (AText[1],result[1],AStart-1); move (ASubText[1],result[AStart],j); move (AText[AStart+ALength], Result[AStart+j],i+1-AStart-ALength); end; - Function RandomFrom(const AValues: array of string): string; overload; begin