Find first of a non existent item still causes deletion

I am looking up an item in a list, an item I have just removed. I expect it to return 0 so that the next remove that I try will not do anything, but in fact it removes another item.
Ex. select “book2” in the ListViewer, click “COButton”, it removes “book2” at index 2 appropriately. However, if I click the “COButton” again, it then removes “book3”. That does not make sense to me.

I am testing in the browser, not the phone.

2 Likes

Sure enough, removing the 0th item from a list in fact removes an existing item:

I’m guessing this bug has been reported before but I couldn’t find it on the forums.

You’ll have to use an if/then block to first check if the item is found and then remove it only if it’s found.

3 Likes

It seemed to me you are duplicating efforts. You already saved the index of the book you want removed so in the in list .... remove # just use app variable BookViewerIndex which actually points to the item to be removed.

2 Likes