diff options
author | Karl Rosaen <krosaen@google.com> | 2009-08-11 18:11:40 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-11 18:11:40 -0700 |
commit | d47fddc5d73f22830a5e557a8e8707b29c28e471 (patch) | |
tree | f4a51d5283714a6e5eda2ec59339ec81aee95f7f /core/java/android | |
parent | 6f82aa3f4d0731dbf03eee56a155b7387eed75e9 (diff) | |
parent | abf44279add64c6f22a40592895225779b8481ea (diff) | |
download | frameworks_base-d47fddc5d73f22830a5e557a8e8707b29c28e471.zip frameworks_base-d47fddc5d73f22830a5e557a8e8707b29c28e471.tar.gz frameworks_base-d47fddc5d73f22830a5e557a8e8707b29c28e471.tar.bz2 |
am abf44279: Fix NPE in SearchDialog (and thereby fix bug 2045398).
Merge commit 'abf44279add64c6f22a40592895225779b8481ea'
* commit 'abf44279add64c6f22a40592895225779b8481ea':
Fix NPE in SearchDialog (and thereby fix bug 2045398).
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/SearchDialog.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java index 9c20a4b..b75bec2 100644 --- a/core/java/android/app/SearchDialog.java +++ b/core/java/android/app/SearchDialog.java @@ -67,6 +67,7 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; +import android.widget.ListAdapter; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; @@ -1750,7 +1751,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS // case we want to dismiss the soft keyboard so the user can see the rest of the // shortcuts. if (isInputMethodNotNeeded() || - (isEmpty() && getDropDownChildCount() >= getAdapter().getCount())) { + (isEmpty() && getDropDownChildCount() >= getAdapterCount())) { mSearchDialog.cancel(); return true; } @@ -1758,6 +1759,11 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS } return false; } + + private int getAdapterCount() { + final ListAdapter adapter = getAdapter(); + return adapter == null ? 0 : adapter.getCount(); + } } protected boolean handleBackKey(int keyCode, KeyEvent event) { |