Don't publish empty barcodes

This commit is contained in:
Andrew Brooks 2018-01-25 21:05:52 -06:00
parent fcaca85066
commit 1cac8c8da5
1 changed files with 5 additions and 0 deletions

View File

@ -48,6 +48,11 @@ main(int argc, char **argv)
while (true) while (true)
{ {
barcode = await_next_barcode(input_fd); barcode = await_next_barcode(input_fd);
if (barcode[0] == '\x00')
{
/* Newline is pressed twice. Ignore any 'empty' barcodes. */
continue;
}
if (zsock_send(zsock, "s", barcode) < 0) if (zsock_send(zsock, "s", barcode) < 0)
{ {
fprintf(stderr, "Sending barcode failed!\n"); fprintf(stderr, "Sending barcode failed!\n");