From f2ef6e252b8fa0119e2fe4a9a86cbe6c466f6d92 Mon Sep 17 00:00:00 2001 From: inoussa Date: Mon, 29 Aug 2011 02:49:04 +0000 Subject: [PATCH] Fix crash in Delphi git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1855 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/imp_utils.pas | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/wst/trunk/imp_utils.pas b/wst/trunk/imp_utils.pas index d41389091..814bebfa3 100644 --- a/wst/trunk/imp_utils.pas +++ b/wst/trunk/imp_utils.pas @@ -280,20 +280,22 @@ Var begin ADest.Clear(); propListLen := GetPropList(PTypeInfo(FParent.ClassInfo),propList); - Try - For i := 0 To Pred(propListLen) Do Begin - If ( propList^[i]^.PropType^.Kind in - [ tkLString{$IFDEF FPC},tkSString,tkAString{$ENDIF}{$IFDEF WST_UNICODESTRING},tkUString{$ENDIF} - ,tkWString, tkEnumeration, - tkInteger,tkInt64{$IFDEF FPC},tkQWord{$ENDIF} - ] - ) - Then - ADest.Add(propList^[i]^.Name); + if (propListLen > 0) then begin + Try + For i := 0 To Pred(propListLen) Do Begin + If ( propList^[i]^.PropType^.Kind in + [ tkLString{$IFDEF FPC},tkSString,tkAString{$ENDIF}{$IFDEF WST_UNICODESTRING},tkUString{$ENDIF} + ,tkWString, tkEnumeration, + tkInteger,tkInt64{$IFDEF FPC},tkQWord{$ENDIF} + ] + ) + Then + ADest.Add(propList^[i]^.Name); + End; + Finally + Freemem(propList,propListLen*SizeOf(Pointer)); End; - Finally - Freemem(propList,propListLen*SizeOf(Pointer)); - End; + end; Result := ADest.Count; end;