On Mon, Apr 25, 2011 at 10:15:57AM +0200, Hans-Peter Diettrich wrote: > > (without specifically assigning it to NIL in the declaration) > > > > var > > slTest :TStringList; > > > > begin > > if Assigned(slTest) then FreeAndNil(slTest); // gives exception > > end; > > When slTest is a local variable, you should initialize it to Nil.
Just to be clear Initialize it in code not in the declaration, since in the declaration afaik that makes it a static variable instead of a truely local one, even when declared with local scope. -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
