Program: 91057
Project: 91057
Buggy source:
private void updateIncludingMenus(){
  WalletAccount account=accountListAdapter.getFocusedAccount();
  boolean isBch=account.getType() == WalletAccount.Type.BCHSINGLEADDRESS || account.getType() == WalletAccount.Type.BCHBIP44;
  final List<Integer> menus=Lists.newArrayList();
  if (!(account instanceof ColuAccount) && !Utils.checkIsLinked(account,_mbwManager.getColuManager().getAccounts().values())) {
    menus.add(R.menu.record_options_menu);
  }
  if ((account instanceof SingleAddressAccount) || (account.isDerivedFromInternalMasterseed())) {
    menus.add(R.menu.record_options_menu_backup);
  }
  if (account instanceof SingleAddressAccount) {
    menus.add(R.menu.record_options_menu_backup_verify);
  }
  if (account instanceof ColuAccount) {
    menus.add(R.menu.record_options_menu_backup);
    menus.add(R.menu.record_options_menu_backup_verify);
  }
  if (!account.isDerivedFromInternalMasterseed() && !isBch) {
    menus.add(R.menu.record_options_menu_delete);
  }
  if (account.isActive() && account.canSpend() && !(account instanceof Bip44PubOnlyAccount)&& !isBch) {
    menus.add(R.menu.record_options_menu_sign);
  }
  if (account.isActive() && !isBch) {
    menus.add(R.menu.record_options_menu_active);
  }
  if (account.isActive() && !(account instanceof CoinapultAccount) && !isBch) {
    menus.add(R.menu.record_options_menu_outputs);
  }
  if (account instanceof CoinapultAccount) {
    menus.add(R.menu.record_options_menu_set_coinapult_mail);
  }
  if (account.isArchived()) {
    menus.add(R.menu.record_options_menu_archive);
  }
  if (account.isActive() && account instanceof ExportableAccount && !isBch) {
    menus.add(R.menu.record_options_menu_export);
  }
  if (account.isActive() && account instanceof Bip44Account && !(account instanceof Bip44PubOnlyAccount)&& AccountManager.INSTANCE.getBTCMasterSeedAccounts().size() > 1 && !isBch) {
    if (!((Bip44Account)account).hasHadActivity()) {
      menus.add(R.menu.record_options_menu_hide_unused);
    }
  }
  if (RecordRowBuilder.showLegacyAccountWarning(account,_mbwManager)) {
    menus.add(R.menu.record_options_menu_ignore_warning);
  }
  if (account.getId().equals(_mbwManager.getLocalTraderManager().getLocalTraderAccountId())) {
    menus.add(R.menu.record_options_menu_detach);
  }
  AppCompatActivity parent=(AppCompatActivity)getActivity();
  Callback actionMode=new Callback(){
    @Override public boolean onCreateActionMode(    ActionMode actionMode,    Menu menu){
      for (      Integer res : menus) {
        actionMode.getMenuInflater().inflate(res,menu);
      }
      return true;
    }
    @Override public boolean onPrepareActionMode(    ActionMode actionMode,    Menu menu){
      return true;
    }
    @Override public boolean onActionItemClicked(    ActionMode actionMode,    MenuItem menuItem){
      if (_mbwManager.getWalletManager(false).getState() == WalletManager.State.SYNCHRONIZING || _mbwManager.getColuManager().getState() == WalletManager.State.SYNCHRONIZING) {
        _toaster.toast(R.string.synchronizing_please_wait,false);
        return true;
      }
      int id=menuItem.getItemId();
      if (id == R.id.miActivate) {
        activateSelected();
        return true;
      }
 else       if (id == R.id.miSetLabel) {
        setLabelOnAccount(accountListAdapter.getFocusedAccount(),"String_Node_Str",true);
        return true;
      }
 else       if (id == R.id.miDeleteRecord) {
        deleteSelected();
        return true;
      }
 else       if (id == R.id.miArchive) {
        archiveSelected();
        return true;
      }
 else       if (id == R.id.miHideUnusedAccount) {
        hideSelected();
        return true;
      }
 else       if (id == R.id.miExport) {
        exportSelectedPrivateKey();
        return true;
      }
 else       if (id == R.id.miIgnoreWarnings) {
        ignoreSelectedPrivateKey();
        return true;
      }
 else       if (id == R.id.miSignMessage) {
        signMessage();
        return true;
      }
 else       if (id == R.id.miDetach) {
        detachFromLocalTrader();
        return true;
      }
 else       if (id == R.id.miShowOutputs) {
        showOutputs();
        return true;
      }
 else       if (id == R.id.miMakeBackup) {
        makeBackup();
        return true;
      }
 else       if (id == R.id.miSingleKeyBackupVerify) {
        verifySingleKeyBackup();
        return true;
      }
 else       if (id == R.id.miRescan) {
        rescan();
        return true;
      }
 else       if (id == R.id.miSetMail) {
        setCoinapultMail();
        return true;
      }
 else       if (id == R.id.miVerifyMail) {
        verifyCoinapultMail();
        return true;
      }
      return false;
    }
    @Override public void onDestroyActionMode(    ActionMode actionMode){
      currentActionMode=null;
      if (accountListAdapter.getFocusedAccount() != null) {
        accountListAdapter.setFocusedAccount(null);
        update();
      }
    }
  }
;
  currentActionMode=parent.startSupportActionMode(actionMode);
  accountListAdapter.setFocusedAccount(account);
  update();
}

Fixed version (ground truth):
private void updateIncludingMenus(){
  WalletAccount account=accountListAdapter.getFocusedAccount();
  boolean isBch=account.getType() == WalletAccount.Type.BCHSINGLEADDRESS || account.getType() == WalletAccount.Type.BCHBIP44;
  final List<Integer> menus=Lists.newArrayList();
  if (!(account instanceof ColuAccount) && !Utils.checkIsLinked(account,_mbwManager.getColuManager().getAccounts().values())) {
    menus.add(R.menu.record_options_menu);
  }
  if ((account instanceof SingleAddressAccount) || (account.isDerivedFromInternalMasterseed())) {
    menus.add(R.menu.record_options_menu_backup);
  }
  if (account instanceof SingleAddressAccount) {
    menus.add(R.menu.record_options_menu_backup_verify);
  }
  if (account instanceof ColuAccount) {
    menus.add(R.menu.record_options_menu_backup);
    menus.add(R.menu.record_options_menu_backup_verify);
  }
  if (!account.isDerivedFromInternalMasterseed() && !isBch) {
    menus.add(R.menu.record_options_menu_delete);
  }
  if (account.isActive() && account.canSpend() && !(account instanceof Bip44PubOnlyAccount)&& !isBch) {
    menus.add(R.menu.record_options_menu_sign);
  }
  if (account.isActive() && !isBch) {
    menus.add(R.menu.record_options_menu_active);
  }
  if (account.isActive() && !(account instanceof CoinapultAccount) && !isBch) {
    menus.add(R.menu.record_options_menu_outputs);
  }
  if (account instanceof CoinapultAccount) {
    menus.add(R.menu.record_options_menu_set_coinapult_mail);
  }
  if (account.getType() != WalletAccount.Type.BCHBIP44 && account.getType() != WalletAccount.Type.BCHSINGLEADDRESS && account.isArchived()) {
    menus.add(R.menu.record_options_menu_archive);
  }
  if (account.isActive() && account instanceof ExportableAccount && !isBch) {
    menus.add(R.menu.record_options_menu_export);
  }
  if (account.isActive() && account instanceof Bip44Account && !(account instanceof Bip44PubOnlyAccount)&& AccountManager.INSTANCE.getBTCMasterSeedAccounts().size() > 1 && !isBch) {
    if (!((Bip44Account)account).hasHadActivity()) {
      menus.add(R.menu.record_options_menu_hide_unused);
    }
  }
  if (RecordRowBuilder.showLegacyAccountWarning(account,_mbwManager)) {
    menus.add(R.menu.record_options_menu_ignore_warning);
  }
  if (account.getId().equals(_mbwManager.getLocalTraderManager().getLocalTraderAccountId())) {
    menus.add(R.menu.record_options_menu_detach);
  }
  AppCompatActivity parent=(AppCompatActivity)getActivity();
  Callback actionMode=new Callback(){
    @Override public boolean onCreateActionMode(    ActionMode actionMode,    Menu menu){
      for (      Integer res : menus) {
        actionMode.getMenuInflater().inflate(res,menu);
      }
      return true;
    }
    @Override public boolean onPrepareActionMode(    ActionMode actionMode,    Menu menu){
      return true;
    }
    @Override public boolean onActionItemClicked(    ActionMode actionMode,    MenuItem menuItem){
      if (_mbwManager.getWalletManager(false).getState() == WalletManager.State.SYNCHRONIZING || _mbwManager.getColuManager().getState() == WalletManager.State.SYNCHRONIZING) {
        _toaster.toast(R.string.synchronizing_please_wait,false);
        return true;
      }
      int id=menuItem.getItemId();
      if (id == R.id.miActivate) {
        activateSelected();
        return true;
      }
 else       if (id == R.id.miSetLabel) {
        setLabelOnAccount(accountListAdapter.getFocusedAccount(),"String_Node_Str",true);
        return true;
      }
 else       if (id == R.id.miDeleteRecord) {
        deleteSelected();
        return true;
      }
 else       if (id == R.id.miArchive) {
        archiveSelected();
        return true;
      }
 else       if (id == R.id.miHideUnusedAccount) {
        hideSelected();
        return true;
      }
 else       if (id == R.id.miExport) {
        exportSelectedPrivateKey();
        return true;
      }
 else       if (id == R.id.miIgnoreWarnings) {
        ignoreSelectedPrivateKey();
        return true;
      }
 else       if (id == R.id.miSignMessage) {
        signMessage();
        return true;
      }
 else       if (id == R.id.miDetach) {
        detachFromLocalTrader();
        return true;
      }
 else       if (id == R.id.miShowOutputs) {
        showOutputs();
        return true;
      }
 else       if (id == R.id.miMakeBackup) {
        makeBackup();
        return true;
      }
 else       if (id == R.id.miSingleKeyBackupVerify) {
        verifySingleKeyBackup();
        return true;
      }
 else       if (id == R.id.miRescan) {
        rescan();
        return true;
      }
 else       if (id == R.id.miSetMail) {
        setCoinapultMail();
        return true;
      }
 else       if (id == R.id.miVerifyMail) {
        verifyCoinapultMail();
        return true;
      }
      return false;
    }
    @Override public void onDestroyActionMode(    ActionMode actionMode){
      currentActionMode=null;
      if (accountListAdapter.getFocusedAccount() != null) {
        accountListAdapter.setFocusedAccount(null);
        update();
      }
    }
  }
;
  currentActionMode=parent.startSupportActionMode(actionMode);
  accountListAdapter.setFocusedAccount(account);
  update();
}