summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Bringert <>2009-04-24 02:57:45 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-04-24 02:57:45 -0700
commit4369397d0697810241f7a7ab22891930067166dd (patch)
tree56b8638992e7071b43799384dad537cb6dbf758a
parent875d50a4b9294b2be33cff6493cae7acd1d07ea7 (diff)
downloadframeworks_base-4369397d0697810241f7a7ab22891930067166dd.zip
frameworks_base-4369397d0697810241f7a7ab22891930067166dd.tar.gz
frameworks_base-4369397d0697810241f7a7ab22891930067166dd.tar.bz2
AI 147681: Fix SearchDialog crash on missing FORMAT suggestion column.
CL 147456 introduced support for HTML formatted search suggestions. This is triggered by the value "html" in the SUGGEST_COLUMN_FORMAT column. However, the code failed to check that the SUGGEST_COLUMN_FORMAT column was present before trying to read it. This resulted in an IllegalStateException being thrown when searching with a suggestion provider that does not include the SUGGEST_COLUMN_FORMAT column. This broke search at least in the Contacts and Music apps. Automated import of CL 147681
-rw-r--r--core/java/android/app/SuggestionsAdapter.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/java/android/app/SuggestionsAdapter.java b/core/java/android/app/SuggestionsAdapter.java
index 0513fe1..af2a321 100644
--- a/core/java/android/app/SuggestionsAdapter.java
+++ b/core/java/android/app/SuggestionsAdapter.java
@@ -150,9 +150,12 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
@Override
public void bindView(View view, Context context, Cursor cursor) {
- ChildViewCache views = (ChildViewCache) view.getTag();
- String format = cursor.getString(mFormatCol);
- boolean isHtml = "html".equals(format);
+ ChildViewCache views = (ChildViewCache) view.getTag();
+ boolean isHtml = false;
+ if (mFormatCol >= 0) {
+ String format = cursor.getString(mFormatCol);
+ isHtml = "html".equals(format);
+ }
setViewText(cursor, views.mText1, mText1Col, isHtml);
setViewText(cursor, views.mText2, mText2Col, isHtml);
setViewIcon(cursor, views.mIcon1, mIconBitmap1Col, mIconName1Col);