It helps a lot when you check for the end of your list before randomly

dereferencing things.

llvm-svn: 42605
This commit is contained in:
Daniel Berlin 2007-10-04 05:29:36 +00:00
parent a4df074d31
commit cd14e3d42a

View File

@ -538,7 +538,8 @@ public:
// We may have hit the beginning of our SparseBitVector, in which case,
// we may need to insert right after this element, which requires moving
// the current iterator forward one, because insert does insert before.
if (ElementIter->index() < ElementIndex)
if (ElementIter != Elements.end() &&
ElementIter->index() < ElementIndex)
ElementIter = Elements.insert(++ElementIter, Element);
else
ElementIter = Elements.insert(ElementIter, Element);