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

Commit abf44279 authored by Karl Rosaen's avatar Karl Rosaen
Browse files

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

parent 021fa3fa
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) {