mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
don't crash when number of INVITEMEANS changes
This won't impact shipping code, but if during development I add then remove a new INVITEMEANS I can crash with AIOOB trying to load by ordinal. So check first.
This commit is contained in:
parent
a61db95266
commit
04eeb8f18f
1 changed files with 8 additions and 4 deletions
|
@ -646,11 +646,15 @@ public class DBUtils {
|
|||
int indxTS = cursor.getColumnIndex( DBHelper.TIMESTAMP );
|
||||
int indxTrgt = cursor.getColumnIndex( DBHelper.TARGET );
|
||||
|
||||
InviteMeans[] values = InviteMeans.values();
|
||||
while ( cursor.moveToNext() ) {
|
||||
InviteMeans means = InviteMeans.values()[cursor.getInt( indxMns )];
|
||||
Date ts = new Date(cursor.getLong(indxTS));
|
||||
String target = cursor.getString( indxTrgt );
|
||||
result.addEntry( means, target, ts );
|
||||
int ordinal = cursor.getInt( indxMns );
|
||||
if ( ordinal < values.length ) {
|
||||
InviteMeans means = values[ordinal];
|
||||
Date ts = new Date(cursor.getLong(indxTS));
|
||||
String target = cursor.getString( indxTrgt );
|
||||
result.addEntry( means, target, ts );
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor.close();
|
||||
|
|
Loading…
Reference in a new issue