   update: () ->
     id = @getPlanId()
     plan = TaskPlanStore.get(id)
-    if (id isnt plan.id)
+    if plan and id isnt plan.id
       @setState({id: plan.id})
     else
-      @setState {}
+      @setState({})
 
   setDueAt: (value) ->
     id = @getPlanId()


    chapters = _.map(TocStore.get(), @renderChapterPanels)

    <BS.Modal backdrop={true} onRequestHide=@doneWithSelection>
      <div className="modal-body select-reading-modal">
        {chapters}
      </div>

    classes.push('disabled') unless @props.enabled
    classes = classes.join(' ')

    deleteLink = <BS.Button bsStyle="danger" onClick={@props.onDelete}>Delete</BS.Button> if @props.enabled

    <span>
      <BS.Button bsStyle="primary" className={classes} onClick={@props.onPublish}>Publish</BS.Button>
