From: erg Date: Thu, 24 Apr 2008 14:51:15 +0000 (+0000) Subject: Ensure that a graph is output when -c is used, even if the graph is empty. X-Git-Tag: LAST_LIBGRAPH~32^2~4215 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33048db276210b240c4f091ca1387d68fc681f59;p=graphviz Ensure that a graph is output when -c is used, even if the graph is empty. --- diff --git a/cmd/gvpr/gvpr.c b/cmd/gvpr/gvpr.c index 1421ece4f..4628628bb 100644 --- a/cmd/gvpr/gvpr.c +++ b/cmd/gvpr/gvpr.c @@ -702,9 +702,13 @@ int main(int argc, char *argv[]) (state->target) && !agnnodes(state->target)) agdelete(state->curgraph, state->target); - /* output graph, if necessary */ - if (state->outgraph && agnnodes(state->outgraph)) - agwrite(state->outgraph, options.outFile); + /* output graph, if necessary + * For this, the outgraph must be defined, and either + * be non-empty or the -c option was used. + */ + if (state->outgraph && + (agnnodes(state->outgraph) || (options.compflags & SRCOUT))) + agwrite(state->outgraph, options.outFile); chkClose(state->curgraph); state->target = 0;