From: Venkat Krishnaraj Date: Mon, 14 Dec 2009 21:03:28 +0000 (-0800) Subject: Patch to fix NPE for view intent on all pictures X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fpackages-apps-Gallery2.git;a=commitdiff_plain;h=ddf7fd22570123567cc87bedd5e6f961436d68fc Patch to fix NPE for view intent on all pictures --- diff --git a/src/com/cooliris/media/Gallery.java b/src/com/cooliris/media/Gallery.java index 361d16bff..62d47e25a 100644 --- a/src/com/cooliris/media/Gallery.java +++ b/src/com/cooliris/media/Gallery.java @@ -47,8 +47,15 @@ public final class Gallery extends Activity { 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) - && getIntent().getExtras().getBoolean("slideshow", false)) { + && slideshowIntent) { if (!imageManagerHasStorage) { Toast.makeText(this, getResources().getString(R.string.no_sd_card), Toast.LENGTH_LONG).show(); finish();