[llvm-commits] [llvm] r42605 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h
Daniel Berlin
dberlin at dberlin.org
Wed Oct 3 22:29:36 PDT 2007
Author: dannyb
Date: Thu Oct 4 00:29:36 2007
New Revision: 42605
URL: http://llvm.org/viewvc/llvm-project?rev=42605&view=rev
Log:
It helps a lot when you check for the end of your list before randomly
dereferencing things.
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42605&r1=42604&r2=42605&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Oct 4 00:29:36 2007
@@ -538,7 +538,8 @@
// 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);
More information about the llvm-commits
mailing list