Skip to content

Commit ff8ed4c

Browse files
committed
handle null adapter better
1 parent ebb84f8 commit ff8ed4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/main/java/com/tokenautocomplete/TokenCompleteTextView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,9 @@ public boolean enoughToFilter() {
543543

544544
@Override
545545
public void performCompletion() {
546-
if (getListSelection() == ListView.INVALID_POSITION && enoughToFilter()) {
546+
if ((getAdapter() == null || getListSelection() == ListView.INVALID_POSITION) && enoughToFilter()) {
547547
Object bestGuess;
548-
if (getAdapter().getCount() > 0 && performBestGuess) {
548+
if (getAdapter() != null && getAdapter().getCount() > 0 && performBestGuess) {
549549
bestGuess = getAdapter().getItem(0);
550550
} else {
551551
bestGuess = defaultObject(currentCompletionText());

0 commit comments

Comments
 (0)