mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
fix a likely-fluke NPE with a test
It seems impossible for the menu to be getting update without init() having been called, but that must be what happened. To check for null.
This commit is contained in:
parent
f890d74e63
commit
c2441c30f4
1 changed files with 82 additions and 76 deletions
|
@ -1451,10 +1451,13 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu( Menu menu )
|
public boolean onPrepareOptionsMenu( Menu menu )
|
||||||
{
|
{
|
||||||
int nGamesSelected = m_mySIS.selGames.size();
|
m_menuPrepared = null != m_mySIS;
|
||||||
|
if ( m_menuPrepared ) {
|
||||||
|
int nGamesSelected = m_mySIS.selGames.size(); // NPE
|
||||||
int nGroupsSelected = m_mySIS.selGroupIDs.size();
|
int nGroupsSelected = m_mySIS.selGroupIDs.size();
|
||||||
int groupCount = m_adapter.getGroupCount();
|
int groupCount = m_adapter.getGroupCount();
|
||||||
m_menuPrepared = 0 == nGamesSelected || 0 == nGroupsSelected;
|
m_menuPrepared = 0 == nGamesSelected || 0 == nGroupsSelected;
|
||||||
|
|
||||||
if ( m_menuPrepared ) {
|
if ( m_menuPrepared ) {
|
||||||
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
|
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
|
||||||
|
|
||||||
|
@ -1533,7 +1536,10 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
Utils.setItemVisible( menu, R.id.games_menu_resend, enable );
|
Utils.setItemVisible( menu, R.id.games_menu_resend, enable );
|
||||||
|
|
||||||
Assert.assertTrue( m_menuPrepared );
|
Assert.assertTrue( m_menuPrepared );
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !m_menuPrepared ) {
|
||||||
Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" );
|
Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" );
|
||||||
}
|
}
|
||||||
return m_menuPrepared;
|
return m_menuPrepared;
|
||||||
|
|
Loading…
Add table
Reference in a new issue