diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2013-09-10 18:11:01 +0800 |
---|---|---|
committer | emancebo <emancebo@cyngn.com> | 2014-09-04 10:40:17 -0700 |
commit | a7cc2eed9ff1f7c205ea75383abb7ea89bf118ff (patch) | |
tree | d7569e5984be19efbab942f1008c844be64a532d /src | |
parent | ea1a3dad769cd1a48cd04a2df2ebe26e443cb5a1 (diff) | |
download | android_packages_apps_Gallery2-a7cc2eed9ff1f7c205ea75383abb7ea89bf118ff.tar.gz android_packages_apps_Gallery2-a7cc2eed9ff1f7c205ea75383abb7ea89bf118ff.tar.bz2 android_packages_apps_Gallery2-a7cc2eed9ff1f7c205ea75383abb7ea89bf118ff.zip |
Gallery2: Fix NPE in LocalSource during monkey test.
The object which is obtained by accquire MediaProvider client is null
when MediaStorage is killed or disabled by monkey test or others.
Add null check in LocalSource.java::pause().
CRs-Fixed: 540075
Change-Id: Icba85e77e86793e344e55255c27b195c11186fc8
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/gallery3d/data/LocalSource.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/data/LocalSource.java b/src/com/android/gallery3d/data/LocalSource.java index 810aef474..8ae885d42 100644 --- a/src/com/android/gallery3d/data/LocalSource.java +++ b/src/com/android/gallery3d/data/LocalSource.java @@ -269,7 +269,11 @@ class LocalSource extends MediaSource { @Override public void pause() { - mClient.release(); - mClient = null; + // Monkey may kill or disable the MediaStorage Application From Setting. + // In this case, NullPointerException will occur for mClient is null. + if (mClient != null) { + mClient.release(); + mClient = null; + } } } |