Safe-casting Pointers in Object Pascal
The Delphi Geek offers this helpful pattern to catch casting issues when dealing with pointers: Deferred crash: TMyObject(aPtr) Immediate crash: TObject(aPtr) as TMyObject And it’s always best to crash sooner than later…