From 9eee58d8e29267d017a04bd97be64284eb487c1f Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Mon, 2 Sep 2013 11:28:22 +0200 Subject: [PATCH] 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. --- sigrok-cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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."); -- 2.30.2