App crashing when appending items to list stored in variable

Please check out my project at this link: https://x.thunkable.com/copy/fc5e211fb43ac7c0edc8e087820b38e0

The issue I’m having is occuring due to blocks on the 4th screen named “StockNameScreen”

My app is crashing when i attempt to insert a value at the end of the list. I have it setup so that I have a list of stock lists, which can be selected, which brings you to another screen, where the selected stock list can be viewed. New stocks can also be added from this screen. 2 other screens are used as input forms for list names and stock names. When attempting to add a stock to the current selected stock list, the app crashes. I have narrowed it down to not being an issue with the localStorage blocks. I tried so that when i click the button to add a stock name, it only attempts to append the stock name to the end of the list, this also crashes the app.

There are a number of potential issues:

  1. There is a known bug that the open event occurs twice. Check out my post on a workaround. If two processes (the two open events) try to modify a variable, that can cause a crash
  2. Switching screens and app/stored variables, especially in Live Test, can behave in unexpected ways. I see your app declares workingstocklist with an empty list. That SHOULD ensure it is a list value, but if you testing session or users experience doesn’t start with the List Viewer Screen, that variable may not be set. Add a check for a null value before you try to perform list operations
  3. Finally, I strongly recommend having the app update a label so you can see where in the logic it is landing. Thunkable is a perpetual beta application, so fundamental operations (like list handling) can and do change in startling ways. Building robust debugging is essential.

Having said all of that, here is how I would try to test your app working around all of these issues:

Notice that the actual changs to APP workling list are contained in false blocks. Once you verify with the label that the proper logic is in fact occuring, change the false values to true and remove the label changes.

Happy Thunking!

1 Like