I don't think this check is necessary, because the loop below won't do anything if `length == 0` anyway.