]> granicus.if.org Git - graphviz/commitdiff
Ensure that a graph is output when -c is used, even if the graph is empty.
authorerg <devnull@localhost>
Thu, 24 Apr 2008 14:51:15 +0000 (14:51 +0000)
committererg <devnull@localhost>
Thu, 24 Apr 2008 14:51:15 +0000 (14:51 +0000)
cmd/gvpr/gvpr.c

index 1421ece4f046249092e7da46cee2c30ac79328b6..4628628bb29b44bcdb3b1c62478ad5f754b3011e 100644 (file)
@@ -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;