From f604eea3f4f59f1e66b5dd9cf91b30ef744d0dec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr>
Date: Wed, 29 Jul 2020 16:04:21 +0200
Subject: [PATCH] [Dive] Server interface: if Eva has not been computed, emit
 an error.

Do not run Eva without warning when the Ivette component is open.
---
 src/plugins/dive/server_interface.ml | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/plugins/dive/server_interface.ml b/src/plugins/dive/server_interface.ml
index 0bd290f0608..b428aa3c26a 100644
--- a/src/plugins/dive/server_interface.ml
+++ b/src/plugins/dive/server_interface.ml
@@ -38,9 +38,16 @@ let get_context =
     match !context with
     | Some c -> c
     | None ->
-      let c = Context.create () in
-      context := Some c;
-      c
+      if Db.Value.is_computed () then
+        let c = Context.create () in
+        context := Some c;
+        c
+      else
+        begin
+          Self.error ~once:true
+            "A prior Eva analysis is required to build the graphs.";
+          Server.Data.failure "Eva analysis not computed"
+        end
 
 
 let global_window = ref {
-- 
GitLab