From: Bert Vermeulen Date: Mon, 2 Sep 2013 09:28:22 +0000 (+0200) Subject: Avoid trying to save to a file if there's nothing to save X-Git-Tag: sigrok-cli-0.5.0~87 X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-cli.git;a=commitdiff_plain;h=9eee58d8e29267d017a04bd97be64284eb487c1f Avoid trying to save to a file if there's nothing to save This works around the division by zero when trying to save analog data. --- diff --git a/sigrok-cli.c b/sigrok-cli.c index 6dbc373..48a409d 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -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.");