diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c index aadee6d34c74c112f84be5977f23135e34ee0d20..8d35893b2fa856741d8098da41add733c2ce25cb 100644 --- a/tools/iio/iio_utils.c +++ b/tools/iio/iio_utils.c @@ -547,6 +547,10 @@ static int calc_digits(int num) { int count = 0; + /* It takes a digit to represent zero */ + if (!num) + return 1; + while (num != 0) { num /= 10; count++;