Delphi / Object Pascal · Exception
What does EListError Exception mean in Delphi / Object Pascal?
Raised when code accesses a TList, TStrings, or TStringList item with an out-of-range index, adds a duplicate string to a TStringList whose Duplicates property is dupError, or inserts into a sorted TStringList at a position that would break the sort order. It's the general list-integrity exception underlying most TStrings-descendant misuse.
Raised when code accesses a TList, TStrings, or TStringList item with an out-of-range index, adds a duplicate string to a TStringList whose Duplicates property is dupError, or inserts into a sorted TStringList at a position that would break the sort order. It's the general list-integrity exception underlying most TStrings-descendant misuse.
Bounds-check Count before indexing, check IndexOf before adding when duplicates matter, and call Add instead of Insert on sorted lists so the list picks the correct position itself.