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

Commit d47fddc5 authored by Karl Rosaen's avatar Karl Rosaen Committed by Android Git Automerger
Browse files

am abf44279: Fix NPE in SearchDialog (and thereby fix bug 2045398).

Merge commit 'abf44279'

* commit 'abf44279':
  Fix NPE in SearchDialog (and thereby fix bug 2045398).
parents 6f82aa3f abf44279
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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) {