From 26b4c7da8efbe05e03dc77ee99dcefda26f01cfa Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 9 Jan 2017 20:55:14 -0800 Subject: [PATCH] log values showing up in the occasional crash --- .../android/xw4/GamesListDelegate.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java index 3633a70d5..dd7f90439 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListDelegate.java @@ -143,7 +143,12 @@ public class GamesListDelegate extends ListDelegateBase if ( ggi.m_expanded ) { List children = makeChildren( groupID ); alist.addAll( children ); - Assert.assertTrue( ggi.m_count == children.size() ); + + if ( BuildConfig.DEBUG && ggi.m_count != children.size() ) { + DbgUtils.loge( TAG, "m_count: %d != size: %d", + ggi.m_count, children.size() ); + Assert.fail(); + } } } @@ -271,15 +276,17 @@ public class GamesListDelegate extends ListDelegateBase int getGroupPosition( long groupID ) { int posn = -1; - long[] positions = getGroupPositions(); - for ( int ii = 0; ii < positions.length; ++ii ) { - if ( positions[ii] == groupID ) { - posn = ii; - break; + if ( -1 != groupID ) { + long[] positions = getGroupPositions(); + for ( int ii = 0; ii < positions.length; ++ii ) { + if ( positions[ii] == groupID ) { + posn = ii; + break; + } + } + if ( -1 == posn ) { + DbgUtils.logd( TAG, "getGroupPosition: group %d not found", groupID ); } - } - if ( -1 == posn ) { - DbgUtils.logd( TAG, "getGroupPosition: group %d not found", groupID ); } return posn; }