Buggy code:
private static final String PERSP_TOP_LEFT_TITLE = WorkbenchMessages . ViewsPreference_perspectiveBar_topLeft ; private static final String PERSP_TOP_RIGHT_TITLE = WorkbenchMessages . ViewsPreference_perspectiveBar_topRight ; private static final String R21PRESENTATION_ID = "org.eclipse.ui.internal.r21presentationFactory" ; private static final String R30PRESENTATION_ID = "org.eclipse.ui.presentations.default" ; private static final String R33PRESENTATION_ID = "org.eclipse.ui.presentations.33" ; private static final String INITIAL_VAL = new String ( ) ; private static final int INITIAL_LOC_INT = - 1 ; private String fastViewLoc = ViewsPreferencePage . INITIAL_VAL ; private String showTextOnPerspBar = ViewsPreferencePage . INITIAL_VAL ; private int editorAlignment ; private boolean editorAlignmentChanged = false ; private int viewAlignment ; private boolean viewAlignmentChanged = false ; private String perspBarLocation ; private Combo themeCombo ; private Combo presentationCombo ; private IConfigurationElement [ ] presentationFactories ; private String currentPresentationFactoryId ; private Button overridePresButton ; private IPropertyChangeListener overrideListener ; private boolean restartPosted = false ; private Group createButtonGroup ( Composite composite , String title ) { } protected Control createContents ( Composite parent ) { } private void createPresentationOverride ( Composite parent ) { } private void updateOverrideState ( boolean override ) { } private void createPresentationCombo ( Composite parent ) { } private void attachControls ( Control leftControl , Control rightControl ) { } private void createEditorTabButtonGroup ( Composite composite ) { } private void createViewTabButtonGroup ( Composite composite ) { } private void createPerspBarTabButtonGroup ( Composite composite ) { } private void hookOverrideListener ( ) { } public void dispose ( ) { } private void updateOverride ( ) { } private void refreshPresentationCombo ( ) { } private void setPresentationSelection ( ) { } private void refreshPresentationFactories ( ) { } private boolean updatePresentationPreferences ( ) { } private void setPresentationPrefs ( String id ) { } private boolean isR33 ( String id ) { } private boolean isR30 ( String id ) { } private boolean isR21 ( String id ) { } private String getSelectedPresentationID ( ) { } private void setR33Preferences ( ) { } private void setR30Preferences ( ) { } private void setViewAlignDefault ( IPreferenceStore internalStore ) { } private void setEditorAlignDefault ( IPreferenceStore internalStore ) { } private void setR21Preferences ( ) { } private void refreshThemeCombo ( String themeToSelect ) { } protected void createShowTextOnPerspectiveBarPref ( Composite composite ) { } protected void createShowTraditionalStyleTabsPref ( Composite composite ) { } protected void createEnableAnimationsPref ( Composite composite ) { } protected IPreferenceStore doGetPreferenceStore ( ) { } public void init ( org . eclipse . ui . IWorkbench workbench ) { } protected void performDefaults ( ) { } public boolean performOk ( ) { IPreferenceStore store = getPreferenceStore ( ) ; IPreferenceStore apiStore = PrefUtil . getAPIPreferenceStore ( ) ; boolean override = store . getBoolean ( OVERRIDE_PRESENTATION ) ; boolean restart = updatePresentationPreferences ( ) ; if ( ( showTextOnPerspBar . equals ( ViewsPreferencePage . INITIAL_VAL ) ) && ( ! override ) ) { apiStore . setToDefault ( SHOW_TEXT_ON_PERSPECTIVE_BAR ) ; } else { apiStore . setValue ( SHOW_TEXT_ON_PERSPECTIVE_BAR , showTextOnPerspectiveBar . getSelection ( ) ) ; } if ( editorAlignmentChanged ) { if ( ( editorAlignment ) == ( ViewsPreferencePage . INITIAL_LOC_INT ) ) { store . setToDefault ( EDITOR_TAB_POSITION ) ; } else if ( ! override ) { store . setValue ( EDITOR_TAB_POSITION , editorAlignment ) ; } else { store . setValue ( EDITOR_TAB_POSITION , editorAlignment ) ; } restart = true ; } if ( viewAlignmentChanged ) { if ( ( viewAlignment ) == ( ViewsPreferencePage . INITIAL_LOC_INT ) ) { store . setToDefault ( VIEW_TAB_POSITION ) ; } else if ( ! override ) { store . setValue ( VIEW_TAB_POSITION , viewAlignment ) ; } else { store . setValue ( VIEW_TAB_POSITION , viewAlignment ) ; } restart = true ; } if ( perspBarLocation . equals ( ViewsPreferencePage . INITIAL_VAL ) ) { apiStore . setToDefault ( DOCK_PERSPECTIVE_BAR ) ; } else if ( ! override ) { apiStore . setValue ( DOCK_PERSPECTIVE_BAR , perspBarLocation ) ; } else { apiStore . setValue ( DOCK_PERSPECTIVE_BAR , perspBarLocation ) ; } if ( fastViewLoc . equals ( ViewsPreferencePage . INITIAL_VAL ) ) { apiStore . setToDefault ( INITIAL_FAST_VIEW_BAR_LOCATION ) ; } else { apiStore . setValue ( INITIAL_FAST_VIEW_BAR_LOCATION , fastViewLoc ) ; } int idx = themeCombo . getSelectionIndex ( ) ; <START_BUG> if ( idx == 0 ) { <END_BUG> Workbench . getInstance ( ) . getThemeManager ( ) . setCurrentTheme ( DEFAULT_THEME ) ; refreshThemeCombo ( DEFAULT_THEME ) ; } else { IThemeDescriptor applyTheme = WorkbenchPlugin . getDefault ( ) . getThemeRegistry ( ) . getThemes ( ) [ ( idx - 1 ) ] ; Workbench . getInstance ( ) . getThemeManager ( ) . setCurrentTheme ( applyTheme . getId ( ) ) ; refreshThemeCombo ( applyTheme . getId ( ) ) ; } apiStore . setValue ( SHOW_TRADITIONAL_STYLE_TABS , showTraditionalStyleTabs . getSelection ( ) ) ; apiStore . setValue ( ENABLE_ANIMATIONS , enableAnimations . getSelection ( ) ) ; PrefUtil . savePrefs ( ) ; if ( restart && ( ! ( restartPosted ) ) ) { if ( ( getContainer ( ) ) instanceof IWorkbenchPreferenceContainer ) { IWorkbenchPreferenceContainer container = ( ( IWorkbenchPreferenceContainer ) ( getContainer ( ) ) ) ; UIJob job = new UIJob ( "Restart<seq2seq4repair_space>Request" ) { public IStatus runInUIThread ( IProgressMonitor monitor ) { int really = new org . eclipse . jface . dialogs . MessageDialog ( null , WorkbenchMessages . ViewsPreference_presentationConfirm_title , null , WorkbenchMessages . ViewsPreference_presentationConfirm_message , org . eclipse . jface . dialogs . MessageDialog . QUESTION , new String [ ] { WorkbenchMessages . ViewsPreference_presentationConfirm_yes , WorkbenchMessages . ViewsPreference_presentationConfirm_no } , 1 ) . open ( ) ; if ( really == ( Window . OK ) ) { PlatformUI . getWorkbench ( ) . restart ( ) ; } return Status . OK_STATUS ; } } ; job . setSystem ( true ) ; container . registerUpdateJob ( job ) ; restartPosted = true ; } } return true ; } }

Fix:
if ( idx <= 0 ) {