fix rematch info getting overwritten the first time a game is

opened. Some GameSummary fields are unknown to jni code and so
shouldn't be saved if they happen to be empty (as they will be when
the GameSummary is created by jni and never merged with what was read
from the DB when the game was loaded.
This commit is contained in:
Eric House 2016-01-21 07:14:57 -08:00
parent 7325377bcb
commit dcedbefd63

View file

@ -291,7 +291,15 @@ public class DBUtils {
values.put( DBHelper.GAMEID, summary.gameID );
values.put( DBHelper.GAME_OVER, summary.gameOver? 1 : 0 );
values.put( DBHelper.LASTMOVE, summary.lastMoveTime );
values.put( DBHelper.EXTRAS, summary.getExtras() );
// Don't overwrite extras! Sometimes this method is called from
// JNIThread which has created the summary from common code that
// doesn't know about Android additions. Leave those unset to
// avoid overwriting.
String extras = summary.getExtras();
if ( null != extras ) {
values.put( DBHelper.EXTRAS, summary.getExtras() );
}
long nextNag = summary.nextTurnIsLocal() ?
NagTurnReceiver.figureNextNag( context,
1000*(long)summary.lastMoveTime )