Skip to content

Commit 0364f67

Browse files
committed
Don't iterate endlessly if an error occurs.
llvm-svn: 271048
1 parent 2bd4f8b commit 0364f67

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/include/llvm/DebugInfo/CodeView/StreamArray.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ template <typename ValueType, typename Extractor> class VarStreamArrayIterator {
9393
if (!Array || IterRef.getLength() == 0 || ThisLen == 0)
9494
return *this;
9595
IterRef = IterRef.drop_front(ThisLen);
96-
if (IterRef.getLength() == 0) {
97-
Array = nullptr;
96+
if (IterRef.getLength() == 0)
9897
ThisLen = 0;
99-
} else {
98+
else
99+
// TODO: We should report an error if Extract fails.
100100
ThisLen = Extract(IterRef, ThisValue);
101-
}
101+
if (ThisLen == 0)
102+
Array = nullptr;
102103
return *this;
103104
}
104105

0 commit comments

Comments
 (0)