diff options
Diffstat (limited to 'mfbt/Vector.h')
-rw-r--r-- | mfbt/Vector.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mfbt/Vector.h b/mfbt/Vector.h index fc43afcf1..07e370426 100644 --- a/mfbt/Vector.h +++ b/mfbt/Vector.h @@ -1232,10 +1232,10 @@ Vector<T, N, AP>::insert(T* aP, U&& aVal) } } else { T oldBack = Move(back()); - if (!append(Move(oldBack))) { /* Dup the last element. */ + if (!append(Move(oldBack))) { return nullptr; } - for (size_t i = oldLength; i > pos; --i) { + for (size_t i = oldLength - 1; i > pos; --i) { (*this)[i] = Move((*this)[i - 1]); } (*this)[pos] = Forward<U>(aVal); |