Don't iterate endlessly if an error occurs.

llvm-svn: 271048
This commit is contained in:
David Majnemer 2016-05-27 21:25:05 +00:00
parent 2bd4f8b66b
commit 0364f67f61
1 changed files with 5 additions and 4 deletions

View File

@ -93,12 +93,13 @@ public:
if (!Array || IterRef.getLength() == 0 || ThisLen == 0)
return *this;
IterRef = IterRef.drop_front(ThisLen);
if (IterRef.getLength() == 0) {
Array = nullptr;
if (IterRef.getLength() == 0)
ThisLen = 0;
} else {
else
// TODO: We should report an error if Extract fails.
ThisLen = Extract(IterRef, ThisValue);
}
if (ThisLen == 0)
Array = nullptr;
return *this;
}