# If cloud variable is null crashing app

**URL:** <https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, database, list\
**Created:** [September 3, 2021, 11:53pm UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445 "2021-09-03T23:53:12Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 3, 2021, 11:53pm UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/1 "2021-09-03T23:53:12Z")

</div>

Does anyone see anything inherently wrong with my blocks?  
In the blocks ‘if history j not equal to null’ there are a few that don’t exist at all in Firebase, but I’m not sure why it’s not just simply excluding them for me and going onto the next object.

Any help is greatly appreciated

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

---

<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:** [September 4, 2021, 12:31am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/2 "2021-09-04T00:31:20Z")

</div>

I don’t think Firebase can store null values. So your list should just cycle through the available nodes in /!Jobs. What does your Firebase database look like? What happens if you remove the `if` block and just add items to the list for every item/node?

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 4, 2021, 1:08am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/3 "2021-09-04T01:08:18Z")

</div>

I get the same result if I don’t have that block.

There’s nothing special about the data, it goes

> !Jobs
> 
> > > Job1
> > > 
> > > > > Field1  
> > > > > Field 2  
> > > > > …  
> > > > > Job2  
> > > > > Field1  
> > > > > …

---

<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:** [September 4, 2021, 1:19am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/4 "2021-09-04T01:19:36Z")

</div>

Why are you setting `app variable Get DB` as a `List`?

Firebase returns **objects** not **lists** , even if the dataset returned looks like a list. Better, set it to `null`.

You `IF condition` is not achievable anyway, whether you have it or not the blocks should act the same.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 4, 2021, 1:34am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/5 "2021-09-04T01:34:59Z")

</div>

K I’ll start setting them to null.

So is there any way to negate objects that are non existent?

---

<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:** [September 4, 2021, 1:54am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/6 "2021-09-04T01:54:34Z")

</div>

In your code, the loop is constructed of a list of `object properties` and therefore you will never come across a property named `null`. This is why, with this `IF condition`, you are trying to catch an impossible case.

Only `Get DB` is initialised to `null`. `Search List` remains as a `list`.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 4, 2021, 2:08am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/7 "2021-09-04T02:08:50Z")

</div>

So using get DB will do this properly?

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 4, 2021, 2:12am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/8 "2021-09-04T02:12:04Z")

</div>

hmmm firebase apparently is true that it cannot store null values. ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/9/69388ccaabdaa73d9ae0c2b8214b44d1908428d5.png)  
It’s been resolved by me, because the same happened for me. so that try typing some “random text” in them. we can just replace the variables with a simple block.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/0/30042ab329332b5809abba9f169393219dc8a3cd.png)  
depended, if you won’t believe me see the data  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/6/36340098725d5163f999f77b99a10eb6af3c066d.png)

---

<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:** [September 4, 2021, 2:19am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/9 "2021-09-04T02:19:08Z")

</div>

> [@overshield](#):
>
> using get DB will do this properly?

Yes.

Your only other source of possible crash is the `app variable Temp Search by`, if this key does not exist in the dataset then you will be attempting to add a `null` entry in your `Search List` which would crash the app.

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 4, 2021, 2:26am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/10 "2021-09-04T02:26:22Z")

</div>

@muneer The same happened for me.

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 4, 2021, 2:27am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/11 "2021-09-04T02:27:29Z")

</div>

I don’t use the Get DB very often at all.  
Did I assemble this correctly? Because nothing happens now with our without the ‘if’ block

By the way how do you make your text grayed like you do when you’re emphasizing it in your replies here?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/3/7388c5301d54ebc04772e004e936ebe73c9d1152.png)

---

<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:** [September 4, 2021, 2:32am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/12 "2021-09-04T02:32:49Z")

</div>

I’m sorry, my comments must have confused you. I was referring to `Get DB` as the variable in your blocks. I didn’t mean to change from cloud to `get block`. The cloud variable is just fine.

To gray the text use the `</>` in the toolbar menu or use Ctrl-E when using the computer.

Hope this explains it better

 ![IMG_20210904_054951](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/5/f51e10e40934a58905b9a217989243b37a7136c9.png)

---

<div class="post-metadata">

**Author:** ![overshield](https://avatars.discourse-cdn.com/v4/letter/o/e19b73/32.png) [@overshield](https://community.thunkable.com/u/overshield)\
**Post date:** [September 4, 2021, 3:01am UTC](https://community.thunkable.com/t/if-cloud-variable-is-null-crashing-app/1486445/13 "2021-09-04T03:01:56Z")

</div>

Perfect thanks, this did solve it!

---

<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/if-cloud-variable-is-null-crashing-app/1486445/14 "2024-11-08T13:17:01Z")

</div>


