Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2006 Aug : IsClass assertion in Delphi 5

www.cryer.info
Managed Newsgroup Archive

IsClass assertion in Delphi 5

Subject:IsClass assertion in Delphi 5
Posted by:"Guy Harel" ()
Date:9 Aug 2006 12:56:24

I maintain an old app. Anybody can tell my why the "is" operator would
assert "read address of 0" ? Its supposed to return false if the object
is null.

I have removed the run-time package option, but the object in question
was created in a unit in the same EXE:

After countless tests, if I remove the "is" operator, then it works.

Old code:

     if ( TObject( myTList.[ i ] is TMyType ) then  <-- assertion
failed in @IsClass
    begin
        myObj := TMyType( myTList.[ i ] );
        ...
    end;

New code:
    // The list contains now only TMyType objects

     myObj := TMyType( myTList.[ i ] );

?
--

Replies:

www.cryer.info
Managed Newsgroup Archive