Fix bad iterator access.

llvm-svn: 248375
This commit is contained in:
Daniel Jasper 2015-09-23 12:47:50 +00:00
parent 029bd93c5d
commit a3e553a22c
1 changed files with 2 additions and 1 deletions

View File

@ -405,7 +405,8 @@ Replacements mergeReplacements(const Replacements &First,
for (auto FirstI = First.begin(), SecondI = Second.begin();
FirstI != First.end() || SecondI != Second.end();) {
bool NextIsFirst = SecondI == Second.end() ||
FirstI->getOffset() < SecondI->getOffset() + Delta;
(FirstI != First.end() &&
FirstI->getOffset() < SecondI->getOffset() + Delta);
MergedReplacement Merged(NextIsFirst ? *FirstI : *SecondI, NextIsFirst,
Delta);
++(NextIsFirst ? FirstI : SecondI);