[clang-tidy] Don't index past the end of a vector.

We actually want the end iterator so just replace it with iterator arithmetic.