From: ellson Date: Tue, 18 Oct 2005 18:27:51 +0000 (+0000) Subject: don't crash when running dot uninstalled X-Git-Tag: LAST_LIBGRAPH~32^2~7324 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9ad0fb982203ea669eedf0fd504638b8a37262d;p=graphviz don't crash when running dot uninstalled --- diff --git a/lib/common/emit.c b/lib/common/emit.c index 24099030b..08681307e 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -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; } diff --git a/lib/gvc/gvc.c b/lib/gvc/gvc.c index 94aa0cf3a..26615b8b6 100644 --- a/lib/gvc/gvc.c +++ b/lib/gvc/gvc.c @@ -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); diff --git a/lib/gvc/gvlayout.c b/lib/gvc/gvlayout.c index 02e318b92..07bff434c 100644 --- a/lib/gvc/gvlayout.c +++ b/lib/gvc/gvlayout.c @@ -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)