[Tooling] fix UB when interpolating compile commands with an empty index

llvm-svn: 329685
This commit is contained in:
Sam McCall 2018-04-10 10:36:46 +00:00
parent c88deb100f
commit 44f2f4ec45
1 changed files with 2 additions and 2 deletions

View File

@ -373,8 +373,8 @@ private:
ArrayRef<SubstringAndIndex>
indexLookup(StringRef Key, const std::vector<SubstringAndIndex> &Idx) const {
// Use pointers as iteratiors to ease conversion of result to ArrayRef.
auto Range =
std::equal_range(&Idx[0], &Idx[Idx.size()], Key, Less<Prefix>());
auto Range = std::equal_range(Idx.data(), Idx.data() + Idx.size(), Key,
Less<Prefix>());
return {Range.first, Range.second};
}