Snapshot.state: fall back on Command.empty_state -- looked-up command might be unavailable due to editing divergence;
authorwenzelm
Sat, 14 Aug 2010 23:01:53 +0200
changeset 38415 f3220ef79d51
parent 38414 49f1f657adc2
child 38416 56e76cd46b4f
Snapshot.state: fall back on Command.empty_state -- looked-up command might be unavailable due to editing divergence;
src/Pure/PIDE/command.scala
src/Pure/System/session.scala
--- a/src/Pure/PIDE/command.scala	Sat Aug 14 22:45:23 2010 +0200
+++ b/src/Pure/PIDE/command.scala	Sat Aug 14 23:01:53 2010 +0200
@@ -184,6 +184,6 @@
 
   /* accumulated results */
 
-  def empty_state: Command.State =
+  val empty_state: Command.State =
     Command.State(this, Command.Status.UNPROCESSED, 0, Nil, new Markup_Text(Nil, source))
 }
--- a/src/Pure/System/session.scala	Sat Aug 14 22:45:23 2010 +0200
+++ b/src/Pure/System/session.scala	Sat Aug 14 23:01:53 2010 +0200
@@ -317,7 +317,8 @@
         def lookup_command(id: Document.Command_ID): Option[Command] =
           state_snapshot.lookup_command(id)
         def state(command: Command): Command.State =
-          state_snapshot.command_state(document, command)
+          try { state_snapshot.command_state(document, command) }
+          catch { case _: State.Fail => command.empty_state }
       }
     }