diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java index da106a17f..4367ab5b3 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/BTInviteDelegate.java @@ -97,7 +97,7 @@ public class BTInviteDelegate extends InviteDelegate { for ( Iterator iter = pairs.iterator(); iter.hasNext(); ) { TwoStringPair pair = iter.next(); - if ( pair.str2.equals( dev ) ) { + if ( TextUtils.equals( pair.str2, dev ) ) { iter.remove(); break; } @@ -105,6 +105,18 @@ public class BTInviteDelegate extends InviteDelegate { } } + private void removeNulls() + { + for ( Iterator iter = pairs.iterator(); + iter.hasNext(); ) { + TwoStringPair pair = iter.next(); + if ( TextUtils.isEmpty( pair.str2 ) ) { + Log.d( TAG, "removeNulls(): removing!!" ); + iter.remove(); + } + } + } + boolean empty() { return pairs == null || pairs.size() == 0; } private void sort() @@ -316,6 +328,7 @@ public class BTInviteDelegate extends InviteDelegate { if ( null == sPersisted ) { try { sPersisted = (Persisted)DBUtils.getSerializableFor( context, KEY_PERSIST ); + sPersisted.removeNulls(); // clean up earlier mistakes } catch ( Exception ex ) {} // NPE, de-serialization problems, etc. if ( null == sPersisted ) {