summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Huang <weih@google.com>2012-03-15 15:23:00 -0700
committerThe Android Automerger <android-build@android.com>2012-03-15 16:37:11 -0700
commit6efbd7283aea80eef8e5001291eb53c9e156e88c (patch)
tree17991a153425ff4e10b7e3cd12221c8de98a6265
parentc510324d8963e78d21695317950042ba2714a87e (diff)
downloadandroid_packages_apps_Gallery2-6efbd7283aea80eef8e5001291eb53c9e156e88c.tar.gz
android_packages_apps_Gallery2-6efbd7283aea80eef8e5001291eb53c9e156e88c.tar.bz2
android_packages_apps_Gallery2-6efbd7283aea80eef8e5001291eb53c9e156e88c.zip
bug #6176711: guard against null GalleryActionBar.
When entering Gallery app from WallPaper picker, the activity is DialogPicker, which doesn't initialize GalleryActionbar so getGalleryActionbar() returns null. Guard against using the null object. I fixed the obvious NPE here, but Ray or Yuli should take a closer look, to see why this is broken. Change-Id: Ic6923c388ea7b72ab402131fc3b039546509e340
-rw-r--r--src/com/android/gallery3d/app/ActivityState.java5
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java5
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java6
3 files changed, 12 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index 443e2bd29..384ae734b 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -141,7 +141,10 @@ abstract public class ActivityState {
actionBar.show();
}
int stateCount = mActivity.getStateManager().getStateCount();
- mActivity.getGalleryActionBar().setDisplayOptions(stateCount > 1, true);
+ GalleryActionBar galleryActionbar = mActivity.getGalleryActionBar();
+ if (galleryActionbar != null) {
+ galleryActionbar.setDisplayOptions(stateCount > 1, true);
+ }
// Default behavior, this can be overridden in ActivityState's onResume.
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index 411464e86..32c5b7fc2 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -319,7 +319,10 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
Path path = mMediaSet.getPath();
boolean enableHomeButton = (mActivity.getStateManager().getStateCount() > 1) |
mParentMediaSetString != null;
- mActivity.getGalleryActionBar().setDisplayOptions(enableHomeButton, true);
+ GalleryActionBar galleryActionBar = mActivity.getGalleryActionBar();
+ if (galleryActionBar != null) {
+ galleryActionBar.setDisplayOptions(enableHomeButton, true);
+ }
// Set the reload bit here to prevent it exit this page in clearLoadingBit().
setLoadingBit(BIT_LOADING_RELOAD);
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 8040a2fc6..a8c69b567 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -630,8 +630,10 @@ public class PhotoPage extends ActivityState
if (mMenuVisibilityListener == null) {
mMenuVisibilityListener = new MyMenuVisibilityListener();
}
- mActivity.getGalleryActionBar().setDisplayOptions(mSetPathString != null, true);
-
+ GalleryActionBar galleryActionBar = mActivity.getGalleryActionBar();
+ if (galleryActionBar != null) {
+ galleryActionBar.setDisplayOptions(mSetPathString != null, true);
+ }
mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener);
onUserInteraction();
}