Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217295 91177308-0d34-0410-b5e6-96231b3b80d8