# Setting variable values in the 'then do' section of BLE blocks causing crash

**URL:** <https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771>\
**Category:** Questions about Thunkable X\
**Created:** [March 20, 2020, 4:52pm UTC](https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771 "2020-03-20T16:52:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [March 20, 2020, 4:52pm UTC](https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771/1 "2020-03-20T16:52:24Z")

</div>

As the title suggest, my app is crashing when i attempt to store either Deviceid’s or DeviceNames using the green block from the Bluetooth component blocks into either stored or app type variables. I am using an iPhone 11 with the latest version of the companion app

as a note: the app works fine until attempting to set the variables to be anything. I also tried populating the list viewer and then setting the variable from list viewer text items and this cauuses a crash. Setting the variable to = the string ‘poop’ did not crash the app.

here is a share link  
[https://x.thunkable.com/copy/3f70d5039868d814060c380f289f65ee](https://x.thunkable.com/copy/3f70d5039868d814060c380f289f65ee)

 ![Screen Shot 2020-03-20 at 12.37.30 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/4/84df23eecbf3c252a1da034dcaa906ad63b6b491.png)

this also causes the same crash

 ![Screen Shot 2020-03-20 at 2.53.11 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/7/87ca7bafe2c95ad4c5e4ee495f881026e0556cc7.png)

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [April 10, 2020, 12:51pm UTC](https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771/2 "2020-04-10T12:51:22Z")

</div>

Interesting.

Can you try storing the `Device IDs` in their own variable, above your if/else block, and then for your else block set the text items to be the global variable, rather than the `DeviceIDs` function variable.

Let me know whether or not that works for you.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [April 10, 2020, 1:23pm UTC](https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771/3 "2020-04-10T13:23:17Z")

</div>

I had done that shortly after I posted. (Kept trying to figure it out)

That works!

---

<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, 11:39am UTC](https://community.thunkable.com/t/setting-variable-values-in-the-then-do-section-of-ble-blocks-causing-crash/525771/4 "2024-11-08T11:39:11Z")

</div>


