From 9f5a64ee50647be9c1d410389ac9a06b5eca39b5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 29 Nov 2012 06:20:45 -0800 Subject: [PATCH] don't try to use null gamePtr. Happens when relay moves arrive for a game whose dict has been deleted. --- .../org/eehouse/android/xw4/GameUtils.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 7456721ad..aa80833e4 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -708,26 +708,27 @@ public class GameUtils { CurGameInfo gi = new CurGameInfo( context ); FeedUtilsImpl feedImpl = new FeedUtilsImpl( context, rowid ); int gamePtr = loadMakeGame( context, gi, feedImpl, sink, lock ); - - XwJNI.comms_resendAll( gamePtr, false, false ); + if ( 0 != gamePtr ) { + XwJNI.comms_resendAll( gamePtr, false, false ); - if ( null != msgs ) { - for ( byte[] msg : msgs ) { - draw = XwJNI.game_receiveMessage( gamePtr, msg, ret ) - || draw; + if ( null != msgs ) { + for ( byte[] msg : msgs ) { + draw = XwJNI.game_receiveMessage( gamePtr, msg, ret ) + || draw; + } } - } - XwJNI.comms_ackAny( gamePtr ); + XwJNI.comms_ackAny( gamePtr ); - // update gi to reflect changes due to messages - XwJNI.game_getGi( gamePtr, gi ); - saveGame( context, gamePtr, gi, lock, false ); - summarizeAndClose( context, lock, gamePtr, gi, feedImpl ); + // update gi to reflect changes due to messages + XwJNI.game_getGi( gamePtr, gi ); + saveGame( context, gamePtr, gi, lock, false ); + summarizeAndClose( context, lock, gamePtr, gi, feedImpl ); - int flags = setFromFeedImpl( feedImpl ); - if ( GameSummary.MSG_FLAGS_NONE != flags ) { - draw = true; - DBUtils.setMsgFlags( rowid, flags ); + int flags = setFromFeedImpl( feedImpl ); + if ( GameSummary.MSG_FLAGS_NONE != flags ) { + draw = true; + DBUtils.setMsgFlags( rowid, flags ); + } } lock.unlock(); }