Fix bug 3198503 - NPE at MenuPopupHelper.dismiss

Make sure dismiss() can be called even when the popup is not currently
showing.

Change-Id: I48077d8b3bfe0df04bceeb056ed54cbd79a6e660
This commit is contained in:
Adam Powell
2010-11-16 10:22:35 -08:00
parent debf3bed9e
commit ed8b403cc8

View File

@@ -110,8 +110,10 @@ public class MenuPopupHelper implements AdapterView.OnItemClickListener, View.On
if (isShowing()) {
mPopup.dismiss();
}
mTreeObserver.removeGlobalOnLayoutListener(this);
mTreeObserver = null;
if (mTreeObserver != null) {
mTreeObserver.removeGlobalOnLayoutListener(this);
mTreeObserver = null;
}
}
public boolean isShowing() {