Fix NPE in ActionBarAdapter
- Fixing the SearchView will require more work, but temporarily
add a null check before calling any method on the SearchView so it
doesn't crash anymore in Monkey tests
Bug: 4584460
Change-Id: Ibb31a1931213cdce82b593c9de62e600d5ba2e35
diff --git a/src/com/android/contacts/activities/ActionBarAdapter.java b/src/com/android/contacts/activities/ActionBarAdapter.java
index 680c8bd..0541edb 100644
--- a/src/com/android/contacts/activities/ActionBarAdapter.java
+++ b/src/com/android/contacts/activities/ActionBarAdapter.java
@@ -108,6 +108,9 @@
if (mSearchMode != flag) {
mSearchMode = flag;
update();
+ if (mSearchView == null) {
+ return;
+ }
if (mSearchMode) {
mSearchView.requestFocus();
} else {
@@ -122,7 +125,9 @@
public void setQueryString(String query) {
mQueryString = query;
- mSearchView.setQuery(query, false);
+ if (mSearchView != null) {
+ mSearchView.setQuery(query, false);
+ }
}
public void update() {