summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorc_yongga <yongga@codeaurora.org>2016-01-05 17:26:44 +0800
committerc_yongga <yongga@codeaurora.org>2016-01-05 17:26:44 +0800
commit5a7bd5db14eceef7df79c748d1416e9e28fcc707 (patch)
tree556e39e9d35c952ad212e286710e6090b99230b7 /src/com
parent37f3c8c6ab31d2fe6b220662efba6d919e50c76c (diff)
downloadandroid_packages_apps_Gallery2-5a7bd5db14eceef7df79c748d1416e9e28fcc707.tar.gz
android_packages_apps_Gallery2-5a7bd5db14eceef7df79c748d1416e9e28fcc707.tar.bz2
android_packages_apps_Gallery2-5a7bd5db14eceef7df79c748d1416e9e28fcc707.zip
Gallery2: Fix null pointer exception from customer monkey test.
The reference is not instantiated before invoking it. Determine whether the reference is instantiated before invoking it. Change-Id: I5448acd8070e01bd6a992d9755fe2d40e3aefbed CRs-Fixed: 951767
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/app/AlbumSetPage.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index d2cc0ca57..c8916fe16 100644
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -244,13 +244,16 @@ public class AlbumSetPage extends ActivityState implements
WeakReference<Toast> mEmptyAlbumToast = null;
private void showEmptyAlbumToast(int toastLength) {
+ //CRs-Fixed:951767 java.lang.NullPointerException: Attempt to invoke virtual method
+ // 'void android.widget.RelativeLayout.addView(android.view.View
+ RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity)
+ .findViewById(R.id.gallery_root);
+ if (galleryRoot == null) return ;
tvEmptyAlbum = new TextView(mActivity);
tvEmptyAlbum.setText(R.string.tvEmptyAlbum);
tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000"));
tvEmptyAlbum.setGravity(Gravity.CENTER);
tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
- RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity)
- .findViewById(R.id.gallery_root);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);