mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
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:
parent
2b0dcbbd17
commit
37d774b9da
1 changed files with 14 additions and 1 deletions
|
@ -97,7 +97,7 @@ public class BTInviteDelegate extends InviteDelegate {
|
||||||
for ( Iterator<TwoStringPair> iter = pairs.iterator();
|
for ( Iterator<TwoStringPair> iter = pairs.iterator();
|
||||||
iter.hasNext(); ) {
|
iter.hasNext(); ) {
|
||||||
TwoStringPair pair = iter.next();
|
TwoStringPair pair = iter.next();
|
||||||
if ( pair.str2.equals( dev ) ) {
|
if ( TextUtils.equals( pair.str2, dev ) ) {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
break;
|
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; }
|
boolean empty() { return pairs == null || pairs.size() == 0; }
|
||||||
|
|
||||||
private void sort()
|
private void sort()
|
||||||
|
@ -316,6 +328,7 @@ public class BTInviteDelegate extends InviteDelegate {
|
||||||
if ( null == sPersisted ) {
|
if ( null == sPersisted ) {
|
||||||
try {
|
try {
|
||||||
sPersisted = (Persisted)DBUtils.getSerializableFor( context, KEY_PERSIST );
|
sPersisted = (Persisted)DBUtils.getSerializableFor( context, KEY_PERSIST );
|
||||||
|
sPersisted.removeNulls(); // clean up earlier mistakes
|
||||||
} catch ( Exception ex ) {} // NPE, de-serialization problems, etc.
|
} catch ( Exception ex ) {} // NPE, de-serialization problems, etc.
|
||||||
|
|
||||||
if ( null == sPersisted ) {
|
if ( null == sPersisted ) {
|
||||||
|
|
Loading…
Reference in a new issue