diff --git a/src/decoder_util.c b/src/decoder_util.c index 6ea9e091c..5817ff333 100644 --- a/src/decoder_util.c +++ b/src/decoder_util.c @@ -56,6 +56,11 @@ static char *bitrow_asprint_code(uint8_t const *bitrow, unsigned bit_len) // remove last nibble if needed row_bytes[2 * (bit_len + 3) / 8] = '\0'; + // print at least one '0' + if (bit_len == 0) { + sprintf(row_bytes, "0"); + } + // a simple bitrow representation row_code = malloc(8 + bit_len / 4 + 1); // "{nnnn}..\0" if (!row_code) { diff --git a/src/devices/flex.c b/src/devices/flex.c index 527901518..692d1a5fd 100644 --- a/src/devices/flex.c +++ b/src/devices/flex.c @@ -317,6 +317,11 @@ static int flex_callback(r_device *decoder, bitbuffer_t *bitbuffer) // add a data line for each getter render_getters(row_data[i], bitbuffer->bb[i], params); + // print at least one '0' + if (row_bytes[0] == '\0') { + sprintf(row_bytes, "0"); + } + // a simpler representation for csv output row_codes[i] = malloc(8 + bitbuffer->bits_per_row[i] / 4 + 1); // "{nnnn}..\0" if (!row_codes[i])