From 15a6600d68847fc9505fe4a89d252469f80deb7a Mon Sep 17 00:00:00 2001 From: Jay Wang Date: Tue, 24 May 2016 16:47:15 -0700 Subject: SnapdragonCamera: Fixed NPE during camera resume There is a race condition that mMenu is not initialized before UI thread accessing the object. This can happen if the initialization of UI thread is completed before camera thread opens the camera device. Since the camera mMenu instance is created in the callback of onCameraOpened(), UI thread needs to check if mMenu is initialized or not before accessing it. Change-Id: Ic8ffc50b7334714de9a57b22f8229bc0ce868901 CRs-Fixed: 1013999 --- src/com/android/camera/PhotoUI.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 250f265b2..7cb7948ce 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -1068,7 +1068,9 @@ public class PhotoUI implements PieListener, mReviewImage.setVisibility(View.GONE); mOnScreenIndicators.setVisibility(View.VISIBLE); mMenuButton.setVisibility(View.VISIBLE); - mMenu.hideTopMenu(false); + if (mMenu != null) { + mMenu.hideTopMenu(false); + } CameraUtil.fadeOut(mReviewDoneButton); mShutterButton.setVisibility(View.VISIBLE); CameraUtil.fadeOut(mReviewRetakeButton); -- cgit v1.2.3