1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-03 02:06:21 +02:00

Fix crash when opening Gadgetbridge from the notification

intent.getAction() can be null, which would throw a NPE.
This commit is contained in:
José Rebelo 2022-10-03 15:54:31 +01:00
parent 96a8785ed5
commit 088b0098b5

View File

@ -553,9 +553,9 @@ public class ControlCenterv2 extends AppCompatActivity
} }
private void handleShortcut(Intent intent) { private void handleShortcut(Intent intent) {
if(intent.getAction().equals(ACTION_CONNECT)) { if (ACTION_CONNECT.equals(intent.getAction())) {
String btDeviceAddress = intent.getStringExtra("device"); String btDeviceAddress = intent.getStringExtra("device");
if(btDeviceAddress!=null){ if (btDeviceAddress!=null) {
GBDevice candidate = DeviceHelper.getInstance().findAvailableDevice(btDeviceAddress, this); GBDevice candidate = DeviceHelper.getInstance().findAvailableDevice(btDeviceAddress, this);
if (candidate != null && !candidate.isConnected()) { if (candidate != null && !candidate.isConnected()) {
GBApplication.deviceService(candidate).connect(); GBApplication.deviceService(candidate).connect();