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:
Eric House 2019-03-08 22:14:57 -08:00
parent f890d74e63
commit c2441c30f4

View file

@ -1451,10 +1451,13 @@ public class GamesListDelegate extends ListDelegateBase
@Override
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 groupCount = m_adapter.getGroupCount();
m_menuPrepared = 0 == nGamesSelected || 0 == nGroupsSelected;
if ( m_menuPrepared ) {
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
@ -1533,7 +1536,10 @@ public class GamesListDelegate extends ListDelegateBase
Utils.setItemVisible( menu, R.id.games_menu_resend, enable );
Assert.assertTrue( m_menuPrepared );
} else {
}
}
if ( !m_menuPrepared ) {
Log.d( TAG, "onPrepareOptionsMenu: incomplete so bailing" );
}
return m_menuPrepared;