Buggy code:
public IEditorPart openEditor ( IEditorInput input , String editorID , boolean activate ) throws PartInitException { } private IEditorPart openEditor ( IEditorInput input , String editorID , boolean activate , boolean useEditorID , IFile file ) throws PartInitException { } private void showEditor ( boolean activate , IEditorPart editor ) { } public boolean isEditorPinned ( IEditorPart editor ) { } public void openSystemEditor ( IFile input ) throws PartInitException { } private boolean partChangeAffectsZoom ( IWorkbenchPartReference ref ) { } public void removeFastView ( IViewReference ref ) { } public void removePartListener ( IPartListener l ) { } public void removePropertyChangeListener ( IPropertyChangeListener listener ) { } public void removeSelectionListener ( ISelectionListener listener ) { } public void removeSelectionListener ( String partId , ISelectionListener listener ) { } public void removePostSelectionListener ( ISelectionListener listener ) { } public void removePostSelectionListener ( String partId , ISelectionListener listener ) { } public void requestActivation ( IWorkbenchPart part ) { } public void resetPerspective ( ) { } public IStatus restoreState ( IMemento memento , IPerspectiveDescriptor activeDescritor ) { String pageName = memento . getString ( TAG_LABEL ) ; if ( pageName == null ) pageName = "" ; MultiStatus result = new MultiStatus ( PlatformUI . PLUGIN_ID , IStatus . OK , WorkbenchMessages . format ( "WorkbenchPage.unableToRestorePerspective" , new String [ ] { pageName } ) , null ) ; String workingSetName = memento . getString ( TAG_WORKING_SET ) ; if ( workingSetName != null ) { WorkingSetManager workingSetManager = ( ( WorkingSetManager ) ( getWorkbenchWindow ( ) . getWorkbench ( ) . getWorkingSetManager ( ) ) ) ; setWorkingSet ( workingSetManager . getWorkingSet ( workingSetName ) ) ; } IMemento childMem = memento . getChild ( TAG_EDITORS ) ; result . merge ( getEditorManager ( ) . restoreState ( childMem ) ) ; childMem = memento . getChild ( TAG_VIEWS ) ; if ( childMem != null ) result . merge ( getViewFactory ( ) . restoreState ( childMem ) ) ; childMem = memento . getChild ( TAG_PERSPECTIVES ) ; String activePartID = childMem . getString ( TAG_ACTIVE_PART ) ; String activePerspectiveID = childMem . getString ( TAG_ACTIVE_PERSPECTIVE ) ; IMemento [ ] perspMems = childMem . getChildren ( TAG_PERSPECTIVE ) ; Perspective activePerspective = null ; for ( int i = 0 ; i < ( perspMems . length ) ; i ++ ) { try { Perspective persp = new Perspective ( null , this ) ; result . merge ( persp . restoreState ( perspMems [ i ] ) ) ; IPerspectiveDescriptor desc = persp . getDesc ( ) ; if ( desc . equals ( activeDescritor ) ) activePerspective = persp ; else if ( ( activePerspective == null ) && ( desc . getId ( ) . equals ( activePerspectiveID ) ) ) activePerspective = persp ; perspList . add ( persp ) ; } catch ( WorkbenchException e ) { } } boolean restoreActivePerspective = false ; if ( activeDescritor == null ) restoreActivePerspective = true ; else if ( ( activePerspective != null ) && ( activePerspective . getDesc ( ) . equals ( activeDescritor ) ) ) { restoreActivePerspective = true ; } else { restoreActivePerspective = false ; activePerspective = createPerspective ( ( ( PerspectiveDescriptor ) ( activeDescritor ) ) ) ; if ( activePerspective == null ) { result . merge ( new Status ( IStatus . ERROR , PlatformUI . PLUGIN_ID , 0 , WorkbenchMessages . format ( "Workbench.showPerspectiveError" , new String [ ] { activeDescritor . getId ( ) } ) , null ) ) ; } } perspList . setActive ( activePerspective ) ; activePerspective = perspList . getActive ( ) ; if ( activePerspective == null ) { activePerspective = perspList . getNextActive ( ) ; perspList . setActive ( activePerspective ) ; result . merge ( activePerspective . restoreState ( ) ) ; } if ( ( activePerspective != null ) && restoreActivePerspective ) result . merge ( activePerspective . restoreState ( ) ) ; if ( activePerspective != null ) { window . firePerspectiveActivated ( this , activePerspective . getDesc ( ) ) ; if ( activePartID != null ) { IViewReference ref = activePerspective . findView ( activePartID ) ; IViewPart view = null ; <START_BUG> if ( ref != null ) ; <END_BUG> view = ref . getView ( true ) ; if ( view != null ) activePart = view ; } } childMem = memento . getChild ( TAG_NAVIGATION_HISTORY ) ; if ( childMem != null ) navigationHistory . restoreState ( childMem ) ; else if ( ( getActiveEditor ( ) ) != null ) navigationHistory . markEditor ( getActiveEditor ( ) ) ; return result ; } public boolean saveAllEditors ( boolean confirm ) { } public boolean saveEditor ( org . eclipse . ui . IEditorPart editor , boolean confirm ) { } public void savePerspective ( ) { } public void savePerspectiveAs ( IPerspectiveDescriptor newDesc ) { } protected void saveToolBarLayout ( ) { } public IStatus saveState ( IMemento memento ) { } private void setActivePart ( IWorkbenchPart newPart ) { } public void setEditorAreaVisible ( boolean showEditorArea ) { } private void setPerspective ( Perspective newPersp ) { } public void setPerspective ( final IPerspectiveDescriptor desc ) { } protected void setToolBarLayout ( ) { } public void setWorkingSet ( IWorkingSet newWorkingSet ) { } public void showActionSet ( String actionSetID ) { } public IViewPart showView ( final String viewID ) throws PartInitException { } private IViewPart showView ( final String viewID , final boolean activate ) throws PartInitException { } public void toggleFastView ( IViewReference ref ) { } public void toggleZoom ( IWorkbenchPart part ) { } public void updateActionBars ( ) { } private void updateTabList ( IWorkbenchPart part ) { } public void updateTitle ( IViewReference ref ) { } void zoomOut ( ) { } private void zoomOutIfNecessary ( IWorkbenchPart part ) { }

Fix:
if ( ref != null )