             @_currentContext = contextModel
 
             # this is needed right now to render the workspace
-            contextModel.set('selected', true)
+            contextModel?.set('selected', true)
 
             # Always show the workspace pane
             @_showWorkspacePane(SidebarView)

            # set more granular file selected flags to be used in ToC
            model.set('selected', true)

            if !@layout.sidebar.currentView or @layout.sidebar.currentView.model != contextModel
              contextView = new SidebarView
                model: contextModel

              @layout.sidebar.show(contextView)
              contextView.maximize()

            model.contentView((view) => if view then @layout.content.show(view)) if model.contentView


            model = decodeURIComponent(model)
            model = allContent.get(model)

            if contextModel
              # Un-escape the `model.id` because a piece of content may have `/` in it (github uses these)
              contextModel = decodeURIComponent(contextModel)
              contextModel = allContent.get(contextModel)

          # Redirect to workspace if model does not exist
          if not model
