From 96a75f02a7e99533aee97e1a8a03717fdf091cc6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 23 Apr 2017 12:00:58 +1200 Subject: [PATCH] Check shortcut action for null --- .../org/traccar/client/ShortcutActivity.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/org/traccar/client/ShortcutActivity.java b/app/src/main/java/org/traccar/client/ShortcutActivity.java index d9054bfc..27fcb681 100644 --- a/app/src/main/java/org/traccar/client/ShortcutActivity.java +++ b/app/src/main/java/org/traccar/client/ShortcutActivity.java @@ -93,22 +93,24 @@ private void checkShortcutAction(Intent intent) { } else { action = intent.getStringExtra(EXTRA_ACTION); } - switch (action) { - case EXTRA_ACTION_START: - PreferenceManager.getDefaultSharedPreferences(this) - .edit().putBoolean(MainActivity.KEY_STATUS, true).commit(); - startService(new Intent(this, TrackingService.class)); - Toast.makeText(this, R.string.status_service_create, Toast.LENGTH_SHORT).show(); - break; - case EXTRA_ACTION_STOP: - PreferenceManager.getDefaultSharedPreferences(this) - .edit().putBoolean(MainActivity.KEY_STATUS, false).commit(); - stopService(new Intent(this, TrackingService.class)); - Toast.makeText(this, R.string.status_service_destroy, Toast.LENGTH_SHORT).show(); - break; - case EXTRA_ACTION_SOS: - sendAlarm(); - break; + if (action != null) { + switch (action) { + case EXTRA_ACTION_START: + PreferenceManager.getDefaultSharedPreferences(this) + .edit().putBoolean(MainActivity.KEY_STATUS, true).commit(); + startService(new Intent(this, TrackingService.class)); + Toast.makeText(this, R.string.status_service_create, Toast.LENGTH_SHORT).show(); + break; + case EXTRA_ACTION_STOP: + PreferenceManager.getDefaultSharedPreferences(this) + .edit().putBoolean(MainActivity.KEY_STATUS, false).commit(); + stopService(new Intent(this, TrackingService.class)); + Toast.makeText(this, R.string.status_service_destroy, Toast.LENGTH_SHORT).show(); + break; + case EXTRA_ACTION_SOS: + sendAlarm(); + break; + } } finish(); }