Bug 1062904 - Null pointer check when saving an image. r=mfinkle, a=lmandel
authordominique vincent <domivinc@toitl.com>
Fri, 19 Sep 2014 05:31:00 -0400
changeset 216801 4bfa8b78669c
parent 216800 73202bfb3f03
child 216802 e1d77019dda9
push id3919
push userryanvm@gmail.com
push date2014-09-19 19:44 +0000
treeherdermozilla-beta@0cc0faf4524b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lmandel
bugs1062904
milestone33.0
Bug 1062904 - Null pointer check when saving an image. r=mfinkle, a=lmandel
mobile/android/base/GeckoApp.java
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -960,16 +960,19 @@ public abstract class GeckoApp
                 while((byteRead = is.read(buf)) != -1) {
                     os.write(buf, 0, byteRead);
                 }
                 byte[] imgBuffer = os.toByteArray();
                 image = BitmapUtils.decodeByteArray(imgBuffer);
             }
             if (image != null) {
                 String path = Media.insertImage(getContentResolver(),image, null, null);
+                if (path == null) {
+                    return;
+                }
                 final Intent intent = new Intent(Intent.ACTION_ATTACH_DATA);
                 intent.addCategory(Intent.CATEGORY_DEFAULT);
                 intent.setData(Uri.parse(path));
 
                 // Removes the image from storage once the chooser activity ends.
                 Intent chooser = Intent.createChooser(intent, getString(R.string.set_image_chooser_title));
                 ActivityResultHandler handler = new ActivityResultHandler() {
                     @Override