]> granicus.if.org Git - graphviz/commitdiff
don't crash when running dot uninstalled
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:27:51 +0000 (18:27 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:27:51 +0000 (18:27 +0000)
lib/common/emit.c
lib/gvc/gvc.c
lib/gvc/gvlayout.c

index 24099030b4370a0e11505511ded7429350beb93d..08681307e528399f3113cda99dde9b6a34d98542 100644 (file)
@@ -1764,6 +1764,11 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
 {
     GVJ_t *job;
 
+    if (!GD_drawing(g)) {
+        fprintf(stderr, "Layout was not done.  Missing layout plugins? \n");
+        return -1;
+    }
+
     init_gvc_from_graph(gvc, g);
     init_layering(gvc, g);
     init_bb(g);
@@ -1771,8 +1776,7 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
     gvc->keybindings = gvevent_key_binding;
     gvc->numkeys = gvevent_key_binding_size;
 
-/*     gvc->active_jobs = NULL;  acive job sets can straddle multiple input graphs */
-    for (job = gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
+    for (gvrender_first_job(gvc); job; job = gvrender_next_job(gvc)) {
        job->g = g;
 
         if (!job->output_file) {        /* if not yet opened */
@@ -1785,7 +1789,7 @@ int gvRenderJobs (GVC_t * gvc, graph_t * g)
         job->output_lang = gvrender_select(job, job->output_langname);
        if (job->output_lang == NO_SUPPORT) {
            fprintf(stderr,"renderer for %s is unavailable\n", job->output_langname);
-           return 1;
+           return -1;
        }
 
         
index 94aa0cf3a9dadd0842a2f99abbabf093cae5998a..26615b8b637adfff639da1d07c2988204d71849f 100644 (file)
@@ -89,10 +89,6 @@ int gvRender(GVC_t *gvc, graph_t *g, char *format, FILE *out)
 
     job = gvc->job;
     job->output_lang = gvrender_select(job, job->output_langname);
-    if (!GD_drawing(g) && job->output_lang != CANONICAL_DOT) {
-        fprintf(stderr, "Layout was not done\n");
-        return -1;
-    }
     job->output_file = out;
 
     gvRenderJobs(gvc, g);
index 02e318b92a6cb8c5e370ff21ae528fe49e60a521..07bff434ca1c104884801bcfb4401737ce17281b 100644 (file)
@@ -60,6 +60,9 @@ int gvLayoutJobs(GVC_t * gvc, graph_t * g)
 {
     gvlayout_engine_t *gvle = gvc->layout.engine;
 
+    if (! gvle)
+       return -1;
+
     graph_init(g, gvc->layout.features->flags & LAYOUT_USES_RANKDIR);
     GD_gvc(g) = gvc;
     if (gvle && gvle->layout)