mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Fix off-by-one in Vector::insert.
This commit is contained in:
parent
ab541cba98
commit
2a9f2dadee
2 changed files with 54 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue