# App crashing after all code is executed succesfully

**URL:** https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373
**Category:** Questions about Thunkable X
**Created:** [July 26, 2021, 7:10am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373 "2021-07-26T07:10:05Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 26, 2021, 7:10am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/1 "2021-07-26T07:10:05Z")

</div>

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?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/6/f65a580debbc545a8579edaf9fe10c842accb445.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/b/4bade6536bea66b0ccf77c782067666112d6aa2f.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/0/e0ed7460a8ecbbd98082330d3ff30bc7373728aa.png)  
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.

---

<div class="post-metadata">

### Author: ![overturner](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@overturner](https://community.thunkable.com/u/overturner)
#### Post date: [July 27, 2021, 6:29am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/2 "2021-07-27T06:29:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 27, 2021, 6:31am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/3 "2021-07-27T06:31:29Z")

</div>

Without that, the app crashes earlier than usual.

---

<div class="post-metadata">

### Author: ![overturner](https://avatars.discourse-cdn.com/v4/letter/o/53a042/32.png) [@overturner](https://community.thunkable.com/u/overturner)
#### Post date: [July 27, 2021, 6:38am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/4 "2021-07-27T06:38:37Z")

</div>

oh ok  
I cant figure out the error for now

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 28, 2021, 4:26am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/5 "2021-07-28T04:26:49Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/3/93c90f8ed16fe30fda3e0d7326b1603cb8ff8c06.png)  
Any suggestions?

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 28, 2021, 6:09am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/6 "2021-07-28T06:09:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 28, 2021, 7:14am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/7 "2021-07-28T07:14:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 28, 2021, 7:34am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/8 "2021-07-28T07:34:36Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 28, 2021, 7:36am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/9 "2021-07-28T07:36:20Z")

</div>

> [@codeswept](#):
>
> 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.

No luck.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 28, 2021, 9:19am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/10 "2021-07-28T09:19:03Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7c2c9a769f75983b3d156d30f3ab1cc5915a137e.png)

I hope this helps you clear the issue.

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 28, 2021, 9:21am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/11 "2021-07-28T09:21:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)
#### Post date: [July 28, 2021, 9:25am UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/12 "2021-07-28T09:25:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:17pm UTC](https://community.thunkable.com/t/app-crashing-after-all-code-is-executed-succesfully/1414373/13 "2024-11-08T13:17:47Z")

</div>


