diff options
| author | Likai Ding <likaid@codeaurora.org> | 2016-01-30 15:57:24 +0800 |
|---|---|---|
| committer | Likai Ding <likaid@codeaurora.org> | 2016-01-30 16:01:27 +0800 |
| commit | 157df6f8e45a243878c6be39c22ef88fd82cc59d (patch) | |
| tree | 10463115112246134cec75ee95793e2c7e604c9c /src | |
| parent | 9140fea09cff9bf7141f12b7464aefa576f5474b (diff) | |
| download | android_packages_apps_Gallery2-157df6f8e45a243878c6be39c22ef88fd82cc59d.tar.gz android_packages_apps_Gallery2-157df6f8e45a243878c6be39c22ef88fd82cc59d.tar.bz2 android_packages_apps_Gallery2-157df6f8e45a243878c6be39c22ef88fd82cc59d.zip | |
Gallery2: fix a NullPointerException
If gallery is launched for picking wallpaper, after entering AlbumPage
and then press back key, the app crashes. In this case, toolbar is not
set up. Add a condition check before calling method on it.
Change-Id: I0522a3518ff43c8963214ae783ac9b4e73245b41
CRs-Fixed: 968930
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 2f628a978..5fc16aa50 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -288,10 +288,13 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster if (mInCameraApp) { GalleryUtils.startGalleryActivity(mActivity); } else if (mActivity.getStateManager().getStateCount() > 1) { - mActivity.getToolbar().setNavigationContentDescription(mActivity.getResources(). - getString(R.string.drawer_desc)); - mActivity.getToolbar().setNavigationIcon(R.drawable.drawer); - ((GalleryActivity)mActivity).toggleNavDrawer(true); + Toolbar toolbar = mActivity.getToolbar(); + if (toolbar != null) { + toolbar.setNavigationContentDescription( + mActivity.getResources().getString(R.string.drawer_desc)); + toolbar.setNavigationIcon(R.drawable.drawer); + ((GalleryActivity) mActivity).toggleNavDrawer(true); + } super.onBackPressed(); } else if (mParentMediaSetString != null) { Bundle data = new Bundle(getData()); |
