Link to home
Start Free TrialLog in
Avatar of BdLm
BdLmFlag for Germany

asked on

TStringList: Check before adding Strings

Before adding strings to a stringlist, I checked if the Stringlsit is assigned with  thios code:

Var  LogStr           :  TStringList;
somewhere else:
     .....
      if not assigned (LogStr) then LogStr:=TStringList.Create;
      LogStr.Add('<h2>  Misalignment check </h2>');


or here .....

procedure TMainForm.DisplayStatusText(InfoText: String);
begin
     if Assigned (LogStr) then
              LogStr.Add('<br> ' + Infotext);

end;


Why does the assigned check don't give me a working check if I aleady did a  LogStr.Free ?
ASKER CERTIFIED SOLUTION
Avatar of MerijnB
MerijnB
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial