]> sigrok.org Git - sigrok-cli.git/blobdiff - sigrok-cli.c
Avoid trying to save to a file if there's nothing to save
[sigrok-cli.git] / sigrok-cli.c
index 6dbc373c6e90521ab8d4153e8ce64dd16b156e72..48a409d3048a149a1c535731d675651bac7bbe78 100644 (file)
@@ -943,7 +943,7 @@ static void datafeed_in(const struct sr_dev_inst *sdi,
                if (outfile && outfile != stdout)
                        fclose(outfile);
 
-               if (opt_output_file && default_output_format) {
+               if (opt_output_file && default_output_format && savebuf->len) {
                        if (sr_session_save(opt_output_file, sdi, savebuf->data,
                                        unitsize, savebuf->len / unitsize) != SR_OK)
                                g_critical("Failed to save session.");