more explicit checks;
authorwenzelm
Fri, 25 Apr 2014 10:51:57 +0200
changeset 56712 c7cf653228ed
parent 56711 ef3d00153e3b
child 56713 3438dfba58fe
more explicit checks;
src/Pure/PIDE/session.scala
--- a/src/Pure/PIDE/session.scala	Thu Apr 24 23:21:00 2014 +0200
+++ b/src/Pure/PIDE/session.scala	Fri Apr 25 10:51:57 2014 +0200
@@ -341,6 +341,8 @@
     def handle_raw_edits(doc_blobs: Document.Blobs, edits: List[Document.Edit_Text])
     //{{{
     {
+      require(prover.isDefined)
+
       prover.get.discontinue_execution()
 
       val previous = global_state.value.history.tip.version
@@ -358,6 +360,8 @@
     def handle_change(change: Session.Change)
     //{{{
     {
+      require(prover.isDefined)
+
       def id_command(command: Command)
       {
         for {
@@ -418,10 +422,10 @@
           val handled = _protocol_handlers.invoke(msg)
           if (!handled) {
             msg.properties match {
-              case Markup.Protocol_Handler(name) =>
+              case Markup.Protocol_Handler(name) if prover.isDefined =>
                 _protocol_handlers = _protocol_handlers.add(prover.get, name)
 
-              case Protocol.Command_Timing(state_id, timing) =>
+              case Protocol.Command_Timing(state_id, timing) if prover.isDefined =>
                 val message = XML.elem(Markup.STATUS, List(XML.Elem(Markup.Timing(timing), Nil)))
                 accumulate(state_id, prover.get.xml_cache.elem(message))
 
@@ -495,7 +499,7 @@
             }
 
           case Stop =>
-            if (phase == Session.Ready) {
+            if (prover.isDefined && is_ready) {
               _protocol_handlers = _protocol_handlers.stop(prover.get)
               global_state.change(_ => Document.State.init)  // FIXME event bus!?
               phase = Session.Shutdown