OSDN Git Service

Fix NPE in switcher popup
authorDoris Liu <tianliu@google.com>
Wed, 6 Mar 2013 19:22:48 +0000 (11:22 -0800)
committerDoris Liu <tianliu@google.com>
Wed, 6 Mar 2013 19:23:29 +0000 (11:23 -0800)
Bug: 8327966
Change-Id: I4181a59871c065435756c100b3e8b43930781ee5

src/com/android/camera/ui/CameraSwitcher.java

index 897729b..326416a 100644 (file)
@@ -140,7 +140,7 @@ public class CameraSwitcher extends RotateImageView
             item.setOnClickListener(new OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    onCameraSelected(index);
+                    if (showsPopup()) onCameraSelected(index);
                 }
             });
             switch (mDrawIds[i]) {
@@ -271,7 +271,7 @@ public class CameraSwitcher extends RotateImageView
                 @Override
                 public void onAnimationEnd(Animator animation) {
                     // Verify that we weren't canceled
-                    if (!showsPopup()) {
+                    if (!showsPopup() && mPopup != null) {
                         mPopup.setVisibility(View.INVISIBLE);
                         ((ViewGroup) mParent).removeView(mPopup);
                         mPopup = null;