Deal with empty sessions nicely.
authorBert Vermeulen <bert@biot.com>
Mon, 7 Apr 2014 13:26:39 +0000 (15:26 +0200)
committerBert Vermeulen <bert@biot.com>
Sun, 13 Apr 2014 18:40:24 +0000 (20:40 +0200)
session.c

index 8b64f49630a608d5d89d93098d973410a26dfc36..d9b6c79209855a7f364f994113564ca2e02c3026 100644 (file)
--- 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);