Getting an error using SaveCSV2

fdx12345

Active Member
Licensed User
Longtime User
I tried posting this question eariler but I believe my computer hickuped and the post was not established, least, I did not see it thus am reposting.

I have a table that I am saving to a file using StringUtils.SaveCSV2. The table can be empty at times before saving. When this occurs, the List variable (type List) will have zero data for a size of zero.

The error I am getting is: IndexOutOfBoundsException: Invalid index 0, size is 0.

How do I get around this? I do not want to add dummy data just so StringUtils.SaveCSV2 will work.
 

fdx12345

Active Member
Licensed User
Longtime User
Check list size

I am checking list size which is showing getting zero. Since there is no data in the List, that is to be expected. The problem is I need to save the blank List because it will be re-loaded if the user closes the program and goes back into it later. If the user has deleted all of the entries and now wishes to add more, I do not want to show them the entries they thought they had deleted.

I have a work around involving coping the orginal file from the apk if the listsize is zero but there are other places in several routines were a listsize of zero is also a problem (an example of this would be loading using LoadTableFromCSV). I am hoping to find a more straight forward solution than a bounch of if, but and Ands statements.
 
Upvote 0
Top