mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
test for null lock. Market reports a NPE that this fixes, though it
can only happen if an onClick handler gets called after onPause(). Assuming that's true, this fixes it.
This commit is contained in:
parent
f53f2dd224
commit
8caefef406
1 changed files with 19 additions and 13 deletions
|
@ -111,13 +111,15 @@ public class RelayGameActivity extends XWActivity
|
|||
if ( room.length() == 0 ) {
|
||||
showOKOnlyDialog( R.string.no_empty_rooms );
|
||||
} else {
|
||||
saveRoomAndName( room );
|
||||
GameUtils.launchGameAndFinish( this, m_path );
|
||||
if ( saveRoomAndName( room ) ) {
|
||||
GameUtils.launchGameAndFinish( this, m_path );
|
||||
}
|
||||
}
|
||||
} else if ( view == m_configButton ) {
|
||||
saveRoomAndName( room );
|
||||
GameUtils.doConfig( this, m_path, GameConfig.class );
|
||||
finish();
|
||||
if ( saveRoomAndName( room ) ) {
|
||||
GameUtils.doConfig( this, m_path, GameConfig.class );
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,16 +128,20 @@ public class RelayGameActivity extends XWActivity
|
|||
return summary.nPlayers == 2;
|
||||
}
|
||||
|
||||
private void saveRoomAndName( String room )
|
||||
private boolean saveRoomAndName( String room )
|
||||
{
|
||||
String name = Utils.getText( this, R.id.local_name_edit );
|
||||
if ( name.length() > 0 ) { // don't wipe existing
|
||||
m_gi.setFirstLocalName( name );
|
||||
boolean canSave = null != m_gameLock;
|
||||
if ( canSave ) {
|
||||
String name = Utils.getText( this, R.id.local_name_edit );
|
||||
if ( name.length() > 0 ) { // don't wipe existing
|
||||
m_gi.setFirstLocalName( name );
|
||||
}
|
||||
m_car.ip_relay_invite = room;
|
||||
GameUtils.applyChanges( this, m_gi, m_car, m_gameLock, false );
|
||||
m_gameLock.unlock();
|
||||
m_gameLock = null;
|
||||
}
|
||||
m_car.ip_relay_invite = room;
|
||||
GameUtils.applyChanges( this, m_gi, m_car, m_gameLock, false );
|
||||
m_gameLock.unlock();
|
||||
m_gameLock = null;
|
||||
return canSave;
|
||||
}
|
||||
|
||||
} // class RelayGameActivity
|
||||
|
|
Loading…
Reference in a new issue