From dcedbefd63f497e0f4862f27fe27bd8d0427702c Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 21 Jan 2016 07:14:57 -0800 Subject: [PATCH] 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. --- .../XWords4/src/org/eehouse/android/xw4/DBUtils.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index 9260eeaee..616f0151d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -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 )