From: Bert Vermeulen Date: Mon, 7 Apr 2014 13:26:39 +0000 (+0200) Subject: Deal with empty sessions nicely. X-Git-Tag: sigrok-cli-0.5.0~15 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=efe1b57dcc6d60c42796d4f7957d2868bc160628;p=sigrok-cli.git Deal with empty sessions nicely. --- diff --git a/session.c b/session.c index 8b64f49..d9b6c79 100644 --- a/session.c +++ b/session.c @@ -685,7 +685,7 @@ void save_chunk_logic(uint8_t *data, uint64_t data_len, int unitsize) (buf_len + max) / unitsize); memcpy(buf, data + max, data_len - max); buf_len = data_len - max; - } else if (data_len == 0) { + } else if (data_len == 0 && last_unitsize != 0) { /* End of data, flush the buffer out. */ sr_session_append(opt_output_file, buf, last_unitsize, buf_len / last_unitsize);