mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
Don't unbundle an invalid NLI: use a static factory method rather than
a constructor since the factory is allowed to fail.
This commit is contained in:
parent
797cb23de2
commit
4cd75abaa9
2 changed files with 25 additions and 13 deletions
|
@ -968,7 +968,7 @@ public class GamesListDelegate extends ListDelegateBase
|
|||
m_rowid = bundle.getLong( SAVE_ROWID );
|
||||
m_rowids = bundle.getLongArray( SAVE_ROWIDS );
|
||||
m_groupid = bundle.getLong( SAVE_GROUPID );
|
||||
m_netLaunchInfo = new NetLaunchInfo( bundle );
|
||||
m_netLaunchInfo = NetLaunchInfo.makeFrom( bundle );
|
||||
m_missingDictName = bundle.getString( SAVE_DICTNAMES );
|
||||
m_nextIsSolo = bundle.getBoolean( SAVE_NEXTSOLO );
|
||||
}
|
||||
|
|
|
@ -91,21 +91,33 @@ public class NetLaunchInfo {
|
|||
init( context, data );
|
||||
}
|
||||
|
||||
public NetLaunchInfo( Bundle bundle )
|
||||
private NetLaunchInfo( Bundle bundle )
|
||||
{
|
||||
room = bundle.getString( MultiService.ROOM );
|
||||
m_inviteID = bundle.getString( MultiService.INVITEID );
|
||||
lang = bundle.getInt( MultiService.LANG );
|
||||
forceChannel = bundle.getInt( MultiService.FORCECHANNEL );
|
||||
dict = bundle.getString( MultiService.DICT );
|
||||
gameName = bundle.getString( MultiService.GAMENAME );
|
||||
nPlayersT = bundle.getInt( MultiService.NPLAYERST );
|
||||
nPlayersH = bundle.getInt( MultiService.NPLAYERSH );
|
||||
m_gameID = bundle.getInt( MultiService.GAMEID );
|
||||
btName = bundle.getString( MultiService.BT_NAME );
|
||||
btAddress = bundle.getString( MultiService.BT_ADDRESS );
|
||||
if ( 0 != lang ) { // don't bother if it's invalid
|
||||
room = bundle.getString( MultiService.ROOM );
|
||||
m_inviteID = bundle.getString( MultiService.INVITEID );
|
||||
forceChannel = bundle.getInt( MultiService.FORCECHANNEL );
|
||||
dict = bundle.getString( MultiService.DICT );
|
||||
gameName = bundle.getString( MultiService.GAMENAME );
|
||||
nPlayersT = bundle.getInt( MultiService.NPLAYERST );
|
||||
nPlayersH = bundle.getInt( MultiService.NPLAYERSH );
|
||||
m_gameID = bundle.getInt( MultiService.GAMEID );
|
||||
btName = bundle.getString( MultiService.BT_NAME );
|
||||
btAddress = bundle.getString( MultiService.BT_ADDRESS );
|
||||
|
||||
m_addrs = new CommsConnTypeSet( bundle.getInt( ADDRS_KEY ) );
|
||||
m_addrs = new CommsConnTypeSet( bundle.getInt( ADDRS_KEY ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static NetLaunchInfo makeFrom( Bundle bundle )
|
||||
{
|
||||
NetLaunchInfo nli = new NetLaunchInfo( bundle );
|
||||
nli.calcValid();
|
||||
if ( !nli.isValid() ) {
|
||||
nli = null;
|
||||
}
|
||||
return nli;
|
||||
}
|
||||
|
||||
public NetLaunchInfo( Context context, Uri data )
|
||||
|
|
Loading…
Reference in a new issue