* Keep old behaviour, but keep issue #40898 solved

This commit is contained in:
Michaël Van Canneyt 2024-08-24 11:02:42 +02:00
parent 97ad8fafd8
commit 58560d333e

View File

@ -1946,11 +1946,16 @@ begin
DupIgnore : Exit; DupIgnore : Exit;
DupError : Error(SDuplicateString,0) DupError : Error(SDuplicateString,0)
end; end;
// Avoid crash in lazarus InsertItem (Result,S);
if Assigned(aObject) then if (aObject<>Nil) then
InsertItem (Result,S,AObject) begin
else BeginUpdate;
InsertItem (Result,S); try
Objects[Result]:=AObject;
finally
EndUpdate;
end;
end;
end; end;
function TStringList.Add(const S: string): Integer; function TStringList.Add(const S: string): Integer;