OSDN Git Service

Patch to fix NPE for view intent on all pictures
authorVenkat Krishnaraj <venkatkrishnaraj@venkat-krishnarajs-macbook-pro.local>
Mon, 14 Dec 2009 21:03:28 +0000 (13:03 -0800)
committerDave Sparks <davidsparks@android.com>
Mon, 14 Dec 2009 23:10:17 +0000 (15:10 -0800)
src/com/cooliris/media/Gallery.java

index 361d16b..62d47e2 100644 (file)
@@ -47,8 +47,15 @@ public final class Gallery extends Activity {
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         final boolean imageManagerHasStorage = ImageManager.quickHasStorage();
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         final boolean imageManagerHasStorage = ImageManager.quickHasStorage();
+        boolean slideshowIntent = false;
+        if (isViewIntent()) {
+            Bundle extras = getIntent().getExtras();
+            if (extras != null) {
+                slideshowIntent = extras.getBoolean("slideshow", false);
+            }
+        }
         if (isViewIntent() && getIntent().getData().equals(Images.Media.EXTERNAL_CONTENT_URI)
         if (isViewIntent() && getIntent().getData().equals(Images.Media.EXTERNAL_CONTENT_URI)
-                && getIntent().getExtras().getBoolean("slideshow", false)) {
+                && slideshowIntent) {
             if (!imageManagerHasStorage) {
                 Toast.makeText(this, getResources().getString(R.string.no_sd_card), Toast.LENGTH_LONG).show();
                 finish();
             if (!imageManagerHasStorage) {
                 Toast.makeText(this, getResources().getString(R.string.no_sd_card), Toast.LENGTH_LONG).show();
                 finish();