Buggy code:
public class WorkbenchPreferenceDialog extends FilteredPreferenceDialog { private static final int LOAD_ID = ( IDialogConstants . CLIENT_ID ) + 1 ; private static final int SAVE_ID = ( IDialogConstants . CLIENT_ID ) + 2 ; static final String FILE_PATH_SETTING = "PreferenceImportExportFileSelectionPage.filePath" ; private static final Point minimumSize = new Point ( 400 , 400 ) ; private static WorkbenchPreferenceDialog instance = null ; private static String LOOK_ICON = "org.eclipse.ui.internal.dialogs.LOOK_ICON" ; private static boolean groupedMode = false ; private Composite toolBarComposite ; private ToolBar toolBar ; private PreferencePageHistory history ; private WorkbenchPreferenceGroup currentGroup ; private CTabItem tab ; private static String lastGroupId = null ; public static final WorkbenchPreferenceDialog createDialogOn ( final String preferencePageId , String [ ] filteredIds ) { } public static final WorkbenchPreferenceDialog createDialogOn ( final String preferencePageId ) { } public WorkbenchPreferenceDialog ( Shell parentShell , PreferenceManager manager ) { } protected void buttonPressed ( int buttonId ) { } public final boolean close ( ) { } protected void createButtonsForButtonBar ( Composite parent ) { } protected void loadPressed ( ) { } private IPath getFilePath ( boolean export ) { } private void setFileNameSetting ( String currentFileName ) { } private String getFileNameSetting ( boolean export ) { } protected void savePressed ( ) { } private boolean importPreferences ( IPath path ) { } public final IPreferencePage getCurrentPage ( ) { } protected Control createDialogArea ( Composite parent ) { } private void createToolBar ( Composite composite ) { } private void createDialogContents ( Composite parent ) { } protected void selectSavedItem ( ) { } private void selectAndRevealInToolBar ( WorkbenchPreferenceGroup group ) { } private void groupSelected ( final WorkbenchPreferenceGroup group ) { WorkbenchPreferenceDialog . lastGroupId = group . getId ( ) ; currentGroup = group ; getTreeViewer ( ) . setInput ( group ) ; Object selection = group . getLastSelection ( ) ; if ( selection == null ) <START_BUG> selection = group . getGroupsAndNodes ( ) [ 0 ] ; <END_BUG> getTreeViewer ( ) . setSelection ( new StructuredSelection ( selection ) , true ) ; } private void selectGroupInToolBar ( final WorkbenchPreferenceGroup group ) { } public Composite createPageContainer ( Composite parent ) { } private Control getContainerToolBar ( Composite composite ) { } private Layout getPageLayout ( ) { } private void createModeSwitch ( ToolBar historyBar , ToolBarManager historyManager ) { } private void setContentAndLabelProviders ( TreeViewer treeViewer ) { } protected boolean showPage ( IPreferenceNode node ) { } public void updateTitle ( ) { } public void updateMessage ( ) { } protected TreeViewer createTreeViewer ( Composite parent ) { } public static boolean showingGroups ( ) { } public static boolean canShowGroups ( ) { } protected static WorkbenchPreferenceGroup [ ] getGroups ( ) { } protected Control createTreeAreaContents ( Composite parent ) { } protected Sash createSash ( Composite composite , Control rightControl ) { } protected void setSearchResults ( String [ ] filteredIds ) { } protected void highlightHits ( String text ) { } protected IPreferenceNode findNodeMatching ( String nodeId ) { } public final void setCurrentPageId ( final String preferencePageId ) { } protected void createPageControl ( IPreferencePage page , Composite parent ) { } }

Fix:
selection = group . getPreferenceNodes ( ) [ 0 ] ;