X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2FlablGraphviz.ml;h=7a30256e3798a54d1f5266a91b225a184cb70d65;hb=74223db3fc45caccb3cfac80971b29cb0613da28;hp=ab817e2940394c19a197810fecd79d6d825711f9;hpb=2c01ff6094173915e7023076ea48b5804dca7778;p=helm.git diff --git a/matita/matita/lablGraphviz.ml b/matita/matita/lablGraphviz.ml index ab817e294..7a30256e3 100644 --- a/matita/matita/lablGraphviz.ml +++ b/matita/matita/lablGraphviz.ml @@ -74,17 +74,22 @@ class graphviz_impl ?packing () = method load_graph_from_file ?(gviz_cmd = "dot") fname = let tmp_png = tempfile () in let rc = Sys.command (mk_gviz_cmd gviz_cmd png_flags fname tmp_png) in - if rc <> 0 then + if rc <> 0 || (Unix.stat tmp_png).Unix.st_size = 0 then begin eprintf ("Graphviz command failed (exit code: %d) on the following graph:\n" ^^ "%s\n%!") rc (HExtlib.input_file fname); - image#set_file tmp_png; - HExtlib.safe_remove tmp_png; - let tmp_map = tempfile () in - ignore (Sys.command (mk_gviz_cmd gviz_cmd map_flags fname tmp_map)); - self#load_map tmp_map; - HExtlib.safe_remove tmp_map + (* CSC: it would be better to show something explaining that the + graph is empty *) + image#clear () + end else begin + image#set_file tmp_png; + HExtlib.safe_remove tmp_png; + let tmp_map = tempfile () in + ignore (Sys.command (mk_gviz_cmd gviz_cmd map_flags fname tmp_map)); + self#load_map tmp_map; + HExtlib.safe_remove tmp_map + end method private load_map fname = let areas = ref [] in