Bug 1282289 - Avoid crash when using Android add-on/HelperApps. r=nalexander
authordragoslav.mlakar <dragoslav.mlakar@gmail.com>
Thu, 28 Jul 2016 07:19:57 +0200
changeset 308496 f8fc21bb232095b7b4c995d259558212cb90a44b
parent 308495 6a5f939e29dec24277cc20696887e7c2eb1e2358
child 308497 1e3c438085ec5397d32f4d90b280d8e236c00b56
push id80347
push userkwierso@gmail.com
push dateSun, 07 Aug 2016 07:17:22 +0000
treeherdermozilla-inbound@d42aacfe34af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1282289
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1282289 - Avoid crash when using Android add-on/HelperApps. r=nalexander
mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
--- a/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/IntentHelper.java
@@ -582,24 +582,25 @@ public final class IntentHelper implemen
 
         public ResultHandler(JSONObject message) {
             this.message = message;
         }
 
         @Override
         public void onActivityResult(int resultCode, Intent data) {
             JSONObject response = new JSONObject();
-
             try {
                 if (data != null) {
-                    response.put("extras", JSONUtils.bundleToJSON(data.getExtras()));
-                    response.put("uri", data.getData().toString());
+                    if (data.getExtras() != null) {
+                        response.put("extras", JSONUtils.bundleToJSON(data.getExtras()));
+                    }
+                    if (data.getData() != null) {
+                        response.put("uri", data.getData().toString());
+                    }
                 }
-
                 response.put("resultCode", resultCode);
             } catch (JSONException e) {
                 Log.w(LOGTAG, "Error building JSON response.", e);
             }
-
             EventDispatcher.sendResponse(message, response);
         }
     }
 }