App crashing after all code is executed succesfully

I’m fetching data from two APIs and then joining them in a table. After all the code is executed, the app crashes. It adds all the rows and displays them and then crashes, but there’s no code after that. What could be the matter?



I have used the open link block to test all the API URLs and other URLs I’m fetching.

The funny thing is, all the code executes properly. I can see the pixabay images and all the data in my data viewer grid. There’s no code after/ apart from what I have shared. I have also tried putting the function ‘hot coffees’ inside the Deleter All Rows block, but that also crashes the app after the rows are added.

You have a wait zero seconds block , is that needed?

1 Like

Without that, the app crashes earlier than usual.

oh ok
I cant figure out the error for now

1 Like

Update: my app is crashing when there are just empty items but no coffee names. I guess my method of tackling nulls is wrong:
image
Any suggestions?

You’re setting app variable all the properties to get object properties of j where j is a value from the JSON response. What happens when you put a Wait block right after that set block and check the value of that variable for all entries in the JSON response just before the Wait block? I bet some of them are null. It may be because of the “empty” JSON values that I mentioned above. The API isn’t formatted very well.

1 Like

Sorry, I didn’t include my update code. I already had wait block after which I display the variable all the properties in a ListViewer. As soon as I see only id in the list viewer (all the empty ones just have the property ‘ID’ and nothing else), the wait 1 second block executes and the app crashes.

Make sure your blocks that follow each delete/create row block should really be below the blocks. I would usually put them inside of the “do” section of those blocks to make sure they run after the delete/create rows. Or have you already tried that?

1 Like

No luck.

Hi @codeswept
I know I’m late but was trying to reproduce the situation you were describing. Today I was able to localize the problem. There was an unannounced change to do with how Thunkable saves data to tables.
Now, if the value is null your app will crash but after creating the row.

Don’t ask me why it crashes if the row creating was successful as it is still a mystery for me but all my tests confirm this situation.

My workaround is
image

I hope this helps you clear the issue.

2 Likes

Thank you so much! I was totally confused as to why it was crashing after all the work was done. Let me test it out and tell you the results.

Yes!!! It worked. Thank you once again.

1 Like