App crash (ANR) if bt is not connected

I made an app using App Inventors. It works, but there is little annoying problem. If you open program and bt device that it should connect automatically (my ebike arduino hc-05 bt ) is not on, app "crash" and android show ANR error screen ("Application Not Responding"). If i click wait, that error goes away and not come back until i close app and open it again.

If my bike arduino is on and app made connection, then everything work fine, no ANR error etc. So how i can get rid of this ANR when there is not bt connetion.

There is screenshot when error come in app:

There is error in android logcat:

There is my blocks in image:

There is my app aia file:
Efat_control_code.aia (51.6 KB)

Hello @Nixu
when starting my app, I use the following method to try to connect a "primary" BT HC05 device.
If it fails, I try a "secondary" address. If it still fails, I repeat the whole procedure still once.
If after the second trial it fails again, I definitely exit the app.
Probably you can use something similar.
I mean: the app closes, but you don't fall into errors.