List index and errors

Hello developers and fans! Could someone please create a block called something like “Any List”? It would be a huge help if it were possible to catch the “list index > list” error—which does crop up from time to time—in a general way. Unfortunately, this error occurs occasionally, and it is often extremely difficult, if not impossible, to figure out which specific list is causing it.

Thanks! :slight_smile:

1 Like

it will be easy to understand your concern if you also share the blocks

You could try to "trap" the error with:


(not all errors can be trapped by this event, but it's worth a try).
Cheers

PS obviously Screen"x" shall be the one where the error arises.

Some one at MIT put up a test server a while ago to test new debugging facilities, including a stack trace. Unfortunately, I have lost a link to that announcement.

It is not possible to catch that error, but you easily can prevent it. Just first check if the list is long enough before selecting an item from the list

Taifun

1 Like

According to @Taifun's suggestion you can use the following blocks (tested on Android 10).
Obviously you have to adapt them to your needs, but probably you can get an idea from them. In a nutshell: whenever you need to select an item from a list you can use the "Item_Select" procedure instead, which returns an error, if the pointer exceeds the current length of the list, otherwise it returns the element.


Hoping they can help.
Trap_list_error.aia (2.8 KB)

There is a video on youtube on these new debugging features: https://www.youtube.com/watch?v=-hVyjsSAwRk

P.S.
On the call stack I'd add the parameter's values too

It's been a while since I've looked at it, but I believe the parameters are a local block on the stack in the latest version.

Unfortunately, those prospective features have not yet been implemented.