on load, remove records missing a device

Can't test because changing the class meant the thing couldn't be
deserialized. Oh well. It was likely a fluke that caused the null dev
entry anyway.
This commit is contained in:
Eric House 2020-06-21 11:32:19 -07:00
parent 2b0dcbbd17
commit 37d774b9da

View file

@ -97,7 +97,7 @@ public class BTInviteDelegate extends InviteDelegate {
for ( Iterator<TwoStringPair> 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<TwoStringPair> 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 ) {