forked from OSchip/llvm-project
don't dereference hte end iterator when inserting at end of buffer.
Patch by Cédric Venet! llvm-svn: 49259
This commit is contained in:
parent
1e830c07a2
commit
53adca6610
|
@ -148,6 +148,7 @@ public:
|
|||
|
||||
iterator getAtOffset(unsigned Offset) {
|
||||
assert(Offset <= CurSize && "Offset out of range!");
|
||||
if (Offset == CurSize) return iterator(Chunks.end(), 0);
|
||||
std::list<RopePiece>::iterator Piece = Chunks.begin();
|
||||
while (Offset >= Piece->size()) {
|
||||
Offset -= Piece->size();
|
||||
|
@ -158,6 +159,7 @@ public:
|
|||
|
||||
const_iterator getAtOffset(unsigned Offset) const {
|
||||
assert(Offset <= CurSize && "Offset out of range!");
|
||||
if (Offset == CurSize) return const_iterator(Chunks.end(), 0);
|
||||
std::list<RopePiece>::const_iterator Piece = Chunks.begin();
|
||||
while (Offset >= Piece->size()) {
|
||||
Offset -= Piece->size();
|
||||
|
|
Loading…
Reference in New Issue