diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java index 4457d3025..c11bf06ca 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBUtils.java @@ -41,6 +41,7 @@ import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify.InviteMeans; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType; import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet; import org.eehouse.android.xw4.jni.CurGameInfo; +import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole; import org.eehouse.android.xw4.jni.DictInfo; import org.eehouse.android.xw4.jni.GameSummary; import org.eehouse.android.xw4.jni.XwJNI; @@ -257,7 +258,7 @@ public class DBUtils { col = cursor.getColumnIndex( DBHelper.SERVERROLE ); tmp = cursor.getInt( col ); - summary.serverRole = CurGameInfo.DeviceRole.values()[tmp]; + summary.serverRole = DeviceRole.values()[tmp]; } cursor.close(); } @@ -761,7 +762,10 @@ public class DBUtils { { HashMap result = new HashMap<>(); String[] columns = { ROW_ID, DBHelper.CONTYPE }; - String selection = String.format( "%s > 0 AND %s != %d", DBHelper.NPACKETSPENDING, + String selection = String.format( "%s != %d AND %s > 0 AND %s != %d", + DBHelper.SERVERROLE, + DeviceRole.SERVER_STANDALONE.ordinal(), + DBHelper.NPACKETSPENDING, DBHelper.GROUPID, getArchiveGroup( context ) ); initDB( context ); synchronized( s_dbHelper ) { @@ -1333,11 +1337,11 @@ public class DBUtils { private boolean m_isSolo; public NeedsNagInfo( long rowid, long nextNag, long lastMove, - CurGameInfo.DeviceRole role ) { + DeviceRole role ) { m_rowid = rowid; m_nextNag = nextNag; m_lastMoveMillis = 1000 * lastMove; - m_isSolo = CurGameInfo.DeviceRole.SERVER_STANDALONE == role; + m_isSolo = DeviceRole.SERVER_STANDALONE == role; } public boolean isSolo() { @@ -1369,8 +1373,8 @@ public class DBUtils { long rowid = cursor.getLong( rowIndex ); long nextNag = cursor.getLong( nagIndex ); long lastMove = cursor.getLong( lastMoveIndex ); - CurGameInfo.DeviceRole role = - CurGameInfo.DeviceRole.values()[cursor.getInt( roleIndex )]; + DeviceRole role = + DeviceRole.values()[cursor.getInt( roleIndex )]; result[ii] = new NeedsNagInfo( rowid, nextNag, lastMove, role ); } } diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java index 63085d447..3e5212d5a 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/jni/XwJNI.java @@ -54,6 +54,7 @@ public class XwJNI { public synchronized long ptr() { Assert.assertTrue( 0 != m_ptrGame ); + // Log.d( TAG, "ptr(): m_rowid: %d", m_rowid ); return m_ptrGame; } diff --git a/xwords4/android/jni/xwjni.c b/xwords4/android/jni/xwjni.c index 57010dcf2..f8b213efa 100644 --- a/xwords4/android/jni/xwjni.c +++ b/xwords4/android/jni/xwjni.c @@ -2409,17 +2409,22 @@ Java_org_eehouse_android_xw4_jni_XwJNI_comms_1resendAll ( JNIEnv* env, jclass C, GamePtrType gamePtr, jboolean force, jobject jFilter, jboolean thenAck ) { - jint result; + jint result = 0; XWJNI_START(); CommsCtxt* comms = state->game.comms; XP_ASSERT( !!comms ); - CommsConnType filter = - NULL == jFilter ? COMMS_CONN_NONE : jEnumToInt( env, jFilter ); - result = comms_resendAll( comms, env, filter, force ); - if ( thenAck ) { + if ( !!comms ) { + CommsConnType filter = + NULL == jFilter ? COMMS_CONN_NONE : jEnumToInt( env, jFilter ); + result = comms_resendAll( comms, env, filter, force ); + if ( thenAck ) { #ifdef XWFEATURE_COMMSACK - comms_ackAny( comms, env ); + comms_ackAny( comms, env ); #endif + } + } else { + /* I've seen this once, but wasn't reproducible */ + XP_LOGFF( "ERROR: called with null comms" ); } XWJNI_END(); return result;