Fix #4228

Note that the function returns before this line if `v` is empty.