Program: 185017
Project: 185017
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!mCanChord) {
    return false;
  }
  if (null == getTopWindow()) {
    return false;
  }
  if (mMenuIsDown) {
    mMenuIsDown=false;
  }
switch (item.getItemId()) {
case R.id.goto_menu_id:
    bookmarksOrHistoryPicker(false);
  break;
case R.id.add_bookmark_menu_id:
Intent i=new Intent(BrowserActivity.this,AddBookmarkPage.class);
WebView w=getTopWindow();
i.putExtra("String_Node_Str",w.getUrl());
i.putExtra("String_Node_Str",w.getTitle());
startActivity(i);
break;
case R.id.stop_reload_menu_id:
if (mInLoad) {
stopLoading();
}
 else {
getTopWindow().reload();
}
break;
case R.id.back_menu_id:
getTopWindow().goBack();
break;
case R.id.forward_menu_id:
getTopWindow().goForward();
break;
case R.id.close_menu_id:
if (mTabControl.getCurrentSubWindow() != null) {
dismissSubWindow(mTabControl.getCurrentTab());
break;
}
closeCurrentWindow();
break;
case R.id.homepage_menu_id:
TabControl.Tab current=mTabControl.getCurrentTab();
if (current != null) {
dismissSubWindow(current);
current.getWebView().loadUrl(mSettings.getHomePage());
}
break;
case R.id.preferences_menu_id:
Intent intent=new Intent(this,BrowserPreferencesPage.class);
startActivityForResult(intent,PREFERENCES_PAGE);
break;
case R.id.find_menu_id:
if (null == mFindDialog) {
mFindDialog=new FindDialog(this);
}
mFindDialog.setWebView(getTopWindow());
mFindDialog.show();
mMenuState=EMPTY_MENU;
break;
case R.id.select_text_id:
getTopWindow().emulateShiftHeld();
break;
case R.id.page_info_menu_id:
showPageInfo(mTabControl.getCurrentTab(),false);
break;
case R.id.classic_history_menu_id:
bookmarksOrHistoryPicker(true);
break;
case R.id.share_page_menu_id:
Browser.sendString(this,getTopWindow().getUrl());
break;
case R.id.dump_nav_menu_id:
getTopWindow().debugDump();
break;
case R.id.zoom_in_menu_id:
getTopWindow().zoomIn();
break;
case R.id.zoom_out_menu_id:
getTopWindow().zoomOut();
break;
case R.id.view_downloads_menu_id:
viewDownloads(null);
break;
case R.id.window_one_menu_id:
case R.id.window_two_menu_id:
case R.id.window_three_menu_id:
case R.id.window_four_menu_id:
case R.id.window_five_menu_id:
case R.id.window_six_menu_id:
case R.id.window_seven_menu_id:
case R.id.window_eight_menu_id:
{
int menuid=item.getItemId();
for (int id=0; id < WINDOW_SHORTCUT_ID_ARRAY.length; id++) {
if (WINDOW_SHORTCUT_ID_ARRAY[id] == menuid) {
TabControl.Tab desiredTab=mTabControl.getTab(id);
if (desiredTab != null && desiredTab != mTabControl.getCurrentTab()) {
switchToTab(id);
mTitleBar.setCurrentTab(id);
}
break;
}
}
}
break;
default :
if (!super.onOptionsItemSelected(item)) {
return false;
}
}
mCanChord=false;
return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (!mCanChord) {
    return false;
  }
  if (null == getTopWindow()) {
    return false;
  }
  if (mMenuIsDown) {
    mMenuIsDown=false;
  }
switch (item.getItemId()) {
case R.id.goto_menu_id:
    bookmarksOrHistoryPicker(false,false);
  break;
case R.id.add_bookmark_menu_id:
Intent i=new Intent(BrowserActivity.this,AddBookmarkPage.class);
WebView w=getTopWindow();
i.putExtra("String_Node_Str",w.getUrl());
i.putExtra("String_Node_Str",w.getTitle());
startActivity(i);
break;
case R.id.stop_reload_menu_id:
if (mInLoad) {
stopLoading();
}
 else {
getTopWindow().reload();
}
break;
case R.id.back_menu_id:
getTopWindow().goBack();
break;
case R.id.forward_menu_id:
getTopWindow().goForward();
break;
case R.id.close_menu_id:
if (mTabControl.getCurrentSubWindow() != null) {
dismissSubWindow(mTabControl.getCurrentTab());
break;
}
closeCurrentWindow();
break;
case R.id.homepage_menu_id:
TabControl.Tab current=mTabControl.getCurrentTab();
if (current != null) {
dismissSubWindow(current);
current.getWebView().loadUrl(mSettings.getHomePage());
}
break;
case R.id.preferences_menu_id:
Intent intent=new Intent(this,BrowserPreferencesPage.class);
startActivityForResult(intent,PREFERENCES_PAGE);
break;
case R.id.find_menu_id:
if (null == mFindDialog) {
mFindDialog=new FindDialog(this);
}
mFindDialog.setWebView(getTopWindow());
mFindDialog.show();
mMenuState=EMPTY_MENU;
break;
case R.id.select_text_id:
getTopWindow().emulateShiftHeld();
break;
case R.id.page_info_menu_id:
showPageInfo(mTabControl.getCurrentTab(),false);
break;
case R.id.classic_history_menu_id:
bookmarksOrHistoryPicker(true,false);
break;
case R.id.share_page_menu_id:
Browser.sendString(this,getTopWindow().getUrl());
break;
case R.id.dump_nav_menu_id:
getTopWindow().debugDump();
break;
case R.id.zoom_in_menu_id:
getTopWindow().zoomIn();
break;
case R.id.zoom_out_menu_id:
getTopWindow().zoomOut();
break;
case R.id.view_downloads_menu_id:
viewDownloads(null);
break;
case R.id.window_one_menu_id:
case R.id.window_two_menu_id:
case R.id.window_three_menu_id:
case R.id.window_four_menu_id:
case R.id.window_five_menu_id:
case R.id.window_six_menu_id:
case R.id.window_seven_menu_id:
case R.id.window_eight_menu_id:
{
int menuid=item.getItemId();
for (int id=0; id < WINDOW_SHORTCUT_ID_ARRAY.length; id++) {
if (WINDOW_SHORTCUT_ID_ARRAY[id] == menuid) {
TabControl.Tab desiredTab=mTabControl.getTab(id);
if (desiredTab != null && desiredTab != mTabControl.getCurrentTab()) {
switchToTab(id);
mTitleBar.setCurrentTab(id);
}
break;
}
}
}
break;
default :
if (!super.onOptionsItemSelected(item)) {
return false;
}
}
mCanChord=false;
return true;
}