Bug 1401282 - Don't assume the intent has an action. r=snorp
authorMichael Kaply <mozilla@kaply.com>
Fri, 29 Sep 2017 16:12:38 -0500
changeset 426691 d300dade1d499efbb83b58b7bce948f0703f496e
parent 426690 163a2b0bb0a06943c3b88ee2018b0dde5fb5883a
child 426692 b8abf66f07492a34279b7b61093a5e125b756269
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewerssnorp
bugs1401282
milestone58.0a1
Bug 1401282 - Don't assume the intent has an action. r=snorp MozReview-Commit-ID: LYayQCljEP4
mobile/android/search/java/org/mozilla/search/SearchWidget.java
--- a/mobile/android/search/java/org/mozilla/search/SearchWidget.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchWidget.java
@@ -59,17 +59,22 @@ public class SearchWidget extends AppWid
             super.onAppWidgetOptionsChanged(context, manager, id, options);
         }
     }
 
     @Override
     public void onReceive(final Context context, final Intent intent) {
         // This will hold the intent to redispatch.
         final Intent redirect;
-        switch (intent.getAction()) {
+        final String action = intent.getAction();
+        if (action == null) {
+          super.onReceive(context, intent);
+          return;
+        }
+        switch (action) {
             case ACTION_LAUNCH_BROWSER:
                 redirect = buildRedirectIntent(Intent.ACTION_MAIN,
                                                context.getPackageName(),
                                                AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS,
                                                intent);
                 Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
                                       TelemetryContract.Method.WIDGET, "browser");
                 break;