mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +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 indxTS = cursor.getColumnIndex( DBHelper.TIMESTAMP );
|
||||||
int indxTrgt = cursor.getColumnIndex( DBHelper.TARGET );
|
int indxTrgt = cursor.getColumnIndex( DBHelper.TARGET );
|
||||||
|
|
||||||
|
InviteMeans[] values = InviteMeans.values();
|
||||||
while ( cursor.moveToNext() ) {
|
while ( cursor.moveToNext() ) {
|
||||||
InviteMeans means = InviteMeans.values()[cursor.getInt( indxMns )];
|
int ordinal = cursor.getInt( indxMns );
|
||||||
Date ts = new Date(cursor.getLong(indxTS));
|
if ( ordinal < values.length ) {
|
||||||
String target = cursor.getString( indxTrgt );
|
InviteMeans means = values[ordinal];
|
||||||
result.addEntry( means, target, ts );
|
Date ts = new Date(cursor.getLong(indxTS));
|
||||||
|
String target = cursor.getString( indxTrgt );
|
||||||
|
result.addEntry( means, target, ts );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
|
Loading…
Reference in a new issue