]> sigrok.org Git - sigrok-cli.git/commitdiff
Avoid trying to save to a file if there's nothing to save
authorBert Vermeulen <redacted>
Mon, 2 Sep 2013 09:28:22 +0000 (11:28 +0200)
committerBert Vermeulen <redacted>
Mon, 2 Sep 2013 09:30:03 +0000 (11:30 +0200)
This works around the division by zero when trying to save analog
data.

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.");