fix crash starting three-device games

This commit is contained in:
Eric House 2022-11-15 17:09:23 -08:00
parent b999da1a92
commit e59161ae2d
3 changed files with 8 additions and 3 deletions

View file

@ -98,6 +98,8 @@ public class InviteChoicesAlert extends DlgDelegateAlert
nInvited = (Integer)params[2]; nInvited = (Integer)params[2];
} }
} }
Log.d( TAG, "populateBuilder(): nMissing=%d, nInvited=%d",
nMissing, nInvited );
means.add( InviteMeans.EMAIL ); means.add( InviteMeans.EMAIL );
means.add( InviteMeans.SMS_USER ); means.add( InviteMeans.SMS_USER );
@ -164,7 +166,8 @@ public class InviteChoicesAlert extends DlgDelegateAlert
; ;
String[] players = XwJNI.kplr_getPlayers(); String[] players = XwJNI.kplr_getPlayers();
mInviteView.setChoices( means, lastSelMeans, players, nMissing, nInvited ) mInviteView.setChoices( means, lastSelMeans, players, nMissing,
nInvited )
.setNli( nli ) .setNli( nli )
.setCallbacks( this ) .setCallbacks( this )
; ;

View file

@ -75,9 +75,10 @@ public class InviteView extends ScrollView
} }
public InviteView setChoices( List<InviteMeans> meansList, int sel, public InviteView setChoices( List<InviteMeans> meansList, int sel,
String[] players, int maxPlayers, String[] players, int nMissing,
int nInvited ) int nInvited )
{ {
Log.d( TAG, "setChoices(nInvited=%d, nMissing=%s)", nInvited, nMissing );
final Context context = getContext(); final Context context = getContext();
boolean haveWho = null != players && 0 < players.length; boolean haveWho = null != players && 0 < players.length;
@ -111,7 +112,7 @@ public class InviteView extends ScrollView
if ( haveWho ) { if ( haveWho ) {
mGroupWho = ((LimSelGroup)findViewById( R.id.group_who )) mGroupWho = ((LimSelGroup)findViewById( R.id.group_who ))
.setLimit( maxPlayers - nInvited ) .setLimit( nMissing )
.addPlayers( players ) .addPlayers( players )
; ;
} }

View file

@ -47,6 +47,7 @@ public class LimSelGroup extends LinearLayout
LimSelGroup setLimit( int limit ) LimSelGroup setLimit( int limit )
{ {
Log.d( TAG, "setLimit(limit=%d)", limit );
Assert.assertTrueNR( 0 < limit ); Assert.assertTrueNR( 0 < limit );
mLimit = limit; mLimit = limit;
return this; return this;