Buggy code:
public class DartOutlinePage_NEW extends Page implements IContentOutlinePage { public static class NameComparator extends ViewerComparator { private static final int NOT_ELEMENT = 2 ; private static final int PRIVATE_ELEMENT = 1 ; private static final int PUBLIC_ELEMENT = 0 ; @ Override public int category ( Object e ) { } @ Override public int compare ( Viewer viewer , Object e1 , Object e2 ) { } } public static class OutlineContentProvider implements ITreeContentProvider { @ Override public void dispose ( ) { } @ Override public Object [ ] getChildren ( Object parentElement ) { } @ Override public Object [ ] getElements ( Object inputElement ) { } @ Override public Object getParent ( Object element ) { } @ Override public boolean hasChildren ( Object element ) { } @ Override public void inputChanged ( Viewer viewer , Object oldInput , Object newInput ) { } } public static class OutlineLabelProvider extends LabelProvider implements IStyledLabelProvider { private final ElementLabelProvider_NEW elementLabelProvider = new ElementLabelProvider_NEW ( ) ; @ Override public Image getImage ( Object obj ) { } @ Override public StyledString getStyledText ( Object obj ) { } @ Override public String getText ( Object obj ) { } } public static class PositionComparator extends ViewerComparator { @ Override public int compare ( Viewer viewer , Object e1 , Object e2 ) { } } private class CollapseAllAction extends InstrumentedAction { CollapseAllAction ( ) { } @ Override protected void doRun ( Event event , UIInstrumentationBuilder instrumentation ) { } } private class DartOutlineViewer extends TreeViewer { public DartOutlineViewer ( Tree tree ) { } private void updateColors ( ) { } } private class ExpandAllAction extends InstrumentedAction { ExpandAllAction ( ) { } @ Override protected void doRun ( Event event , UIInstrumentationBuilder instrumentation ) { } } private class HideNonPublicAction extends InstrumentedAction { HideNonPublicAction ( ) { } @ Override protected void doRun ( Event event , UIInstrumentationBuilder instrumentation ) { } } private class LexicalSortingAction extends InstrumentedAction { public LexicalSortingAction ( ) { } @ Override protected void doRun ( Event event , UIInstrumentationBuilder instrumentation ) { } private void valueChanged ( final boolean on , boolean store ) { } } public static final IElementComparer OUTLINE_COMPARER = new IElementComparer ( ) { @ Override public boolean equals ( Object a , Object b ) { } @ Override public int hashCode ( Object element ) { } } ; private static Outline getOutlineAtOffset ( Outline outline , int offset ) { } private static boolean isEqualOutlineTree ( Outline a , Outline b ) { } private final ListenerList selectionChangedListeners = new ListenerList ( ListenerList . IDENTITY ) ; private final String contextMenuID ; private DartEditor editor ; private Outline input ; private int offset ; private DartOutlinePage_NEW . DartOutlineViewer viewer ; private boolean ignoreSelectionChangedEvent = false ; private Menu contextMenu ; private CompositeActionGroup actionGroups ; private IPreferenceStore preferences ; private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener ( ) { @ Override public void propertyChange ( PropertyChangeEvent event ) { } } ; private static final ViewerComparator NAME_COMPARATOR = new DartOutlinePage_NEW . NameComparator ( ) ; private static final ViewerComparator POSITION_COMPARATOR = new DartOutlinePage_NEW . PositionComparator ( ) ; private static final ViewerFilter PUBLIC_FILTER = new ViewerFilter ( ) { @ Override public boolean select ( Viewer viewer , Object parentElement , Object o ) { } } ; public DartOutlinePage_NEW ( String contextMenuID , DartEditor editor ) { } @ Override public void addSelectionChangedListener ( ISelectionChangedListener listener ) { } @ Override public void createControl ( Composite parent ) { } @ Override public void dispose ( ) { } @ Override public Control getControl ( ) { } @ Override public ISelection getSelection ( ) { } @ Override public void removeSelectionChangedListener ( ISelectionChangedListener listener ) { } public void select ( int offset ) { Outline newOutline = DartOutlinePage_NEW . getOutlineAtOffset ( input , offset ) ; <START_BUG> if ( newOutline == null ) { <END_BUG> return ; } IStructuredSelection selection = ( ( IStructuredSelection ) ( viewer . getSelection ( ) ) ) ; Outline oldOutline = ( ( Outline ) ( selection . getFirstElement ( ) ) ) ; if ( DartOutlinePage_NEW . isEqualOutlineTree ( oldOutline , newOutline ) ) { return ; } setSelection ( new org . eclipse . jface . viewers . StructuredSelection ( newOutline ) ) ; viewer . reveal ( newOutline ) ; } @ Override public void setFocus ( ) { } public void setInput ( Outline input , int offset ) { } @ Override public void setSelection ( ISelection newSelection ) { } protected void toggleExpansion ( ISelection selection ) { } private void contextMenuAboutToShow ( IMenuManager menu ) { } private void doPropertyChange ( PropertyChangeEvent event ) { } private void internalSetInput ( ) { } }

Fix:
if ( ( newOutline == null ) || ( ( viewer ) == null ) ) {