mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-24 07:58:34 +01:00
avoid crash (maybe on corrupt data?)
This commit is contained in:
parent
f1eea13c5e
commit
ba99eb0838
2 changed files with 19 additions and 3 deletions
|
@ -128,9 +128,19 @@ public class BTInviteDelegate extends InviteDelegate
|
||||||
Collections.sort( pairs, new Comparator<TwoStringPair>() {
|
Collections.sort( pairs, new Comparator<TwoStringPair>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare( TwoStringPair rec1, TwoStringPair rec2 ) {
|
public int compare( TwoStringPair rec1, TwoStringPair rec2 ) {
|
||||||
|
int result = 0;
|
||||||
|
try {
|
||||||
long val1 = stamps.get( rec1.str2 );
|
long val1 = stamps.get( rec1.str2 );
|
||||||
long val2 = stamps.get( rec2.str2 );
|
long val2 = stamps.get( rec2.str2 );
|
||||||
return (int)(val2 - val1);
|
if ( val2 > val1 ) {
|
||||||
|
result = 1;
|
||||||
|
} else if ( val1 > val2 ) {
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
|
} catch ( Exception ex ) {
|
||||||
|
Log.e( TAG, "ex %s on %s vs %s", ex, rec1, rec2 );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,12 @@ abstract class InviteDelegate extends DelegateBase
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return String.format( "{dev: \"%s\", str2: \"%s\"}", mDev, str2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String DEVS = "DEVS";
|
public static final String DEVS = "DEVS";
|
||||||
|
|
Loading…
Add table
Reference in a new issue