OSDN Git Service

Don't crash if WallpaperCropActivity isn't passed a URI
authorMichael Jurka <mikejurka@google.com>
Mon, 14 Oct 2013 21:09:21 +0000 (14:09 -0700)
committerMichael Jurka <mikejurka@google.com>
Mon, 14 Oct 2013 21:09:43 +0000 (14:09 -0700)
Bug: 11173560

src/com/android/launcher3/WallpaperCropActivity.java

index 79cc88e..30ec340 100644 (file)
@@ -87,9 +87,15 @@ public class WallpaperCropActivity extends Activity {
 
         mCropView = (CropView) findViewById(R.id.cropView);
 
-        Intent cropIntent = this.getIntent();
+        Intent cropIntent = getIntent();
         final Uri imageUri = cropIntent.getData();
 
+        if (imageUri == null) {
+            Log.e(LOGTAG, "No URI passed in intent, exiting WallpaperCropActivity");
+            finish();
+            return;
+        }
+
         int rotation = getRotationFromExif(this, imageUri);
         mCropView.setTileSource(new BitmapRegionTileSource(this, imageUri, 1024, rotation), null);
         mCropView.setTouchEnabled(true);