Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4369397d authored by Bjorn Bringert's avatar Bjorn Bringert Committed by The Android Open Source Project
Browse files

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
parent 875d50a4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -151,8 +151,11 @@ class SuggestionsAdapter extends ResourceCursorAdapter {
    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        ChildViewCache views = (ChildViewCache) view.getTag();
        boolean isHtml = false;
        if (mFormatCol >= 0) {
            String format = cursor.getString(mFormatCol);
        boolean isHtml = "html".equals(format); 
            isHtml = "html".equals(format);    
        }
        setViewText(cursor, views.mText1, mText1Col, isHtml);
        setViewText(cursor, views.mText2, mText2Col, isHtml);
        setViewIcon(cursor, views.mIcon1, mIconBitmap1Col, mIconName1Col);