#1 Yesterday 11:41:22

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 474

variable that is nil is used and cause exception

mormot.core.collections, line 902

if fDynArray.Info.ArrayRtti is nil then fDynArray.Info.ArrayRtti.Kind will cause exception
I have random errors from that

constructor TIListParent.CreateRtti(aDynArray: TRttiCustom;
  aItemTypeInfo: PRttiInfo; aOptions: TListOptions; aSortAs: TRttiParserType);
begin
  fDynArray.InitRtti(aDynArray, fValue, @fCount);
  aSortAs := fDynArray.SetParserType(aSortAs, // aSortAs=ptNone->RTTI
    loCaseInsensitive in fOptions);
  if (fDynArray.Info.ArrayRtti = nil) or
     (fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind)  then
    EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
      [self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
       aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);

Offline

#2 Yesterday 16:13:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,259
Website

Re: variable that is nil is used and cause exception

Which compiler?
Which array type?

I guess there is not enough RTTI for this.

Offline

#3 Yesterday 21:56:59

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 474

Re: variable that is nil is used and cause exception

@ab, Delphi 11.3 in a Torm class
but:
if (fDynArray.Info.ArrayRtti = nil) or
     (fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind)  then
    EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
      [self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
       aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);

Offline

#4 Today 07:40:51

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,259
Website

Re: variable that is nil is used and cause exception

I still don't understand how you defined the IList instance.

Offline

Board footer

Powered by FluxBB