Fix an overflow found by ASAN

Sometimes len is 0