Bug Report T184967
Visible to All Users

The "List index out of bounds" exception occurs when loading corrupted data using the LoadFromStrings method

created 10 years ago

Hello,
I have a problem with TdxMemData on load CSV file with LoadFromStrings.
If the CSV file is not correctly formed, then I obtain an error “list index out of limit” because the number of values is different to number of fields.
My workaround: I change one line of the code of LoadFromStrings:

Delphi
procedure TdxCustomMemData.LoadFromStrings(AStrings: TStrings); ... else begin Append; // old line : for J := 0 to AValues.Count - 1 do for J := 0 to Min(AValues.Count, AFields.Count) - 1 do if (AFields[J] <> nil) and (AValues[J] <> '') then TField(AFields[J]).Text := AValues[J]; Post; end; ...

Do you want to apply this patch in the next release?

Thank you.
Best regards.

Answers approved by DevExpress Support

created 10 years ago

We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    created 10 years ago

    Hello Laurent,

    This behavior is by design. As you can see in the "TdxCustomMemData.LoadFromStrings" help topic, "the string list must contain data in the format that is produced by the SaveToStrings method. "
    However, I understand your viewpoint and we will consider your comments. I need to mention though that if we still decide to implement this feature, this will be done in a new major version only.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.