Skip to content

Commit e5ccaa7

Browse files
committed
Merge pull request #105334 from WindyDarian/insert_at_end
Allow inserting at end of array again
2 parents 15ed563 + effd1b7 commit e5ccaa7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/variant/array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ Error Array::insert(int p_pos, const Variant &p_value) {
318318
p_pos = _p->array.size() + p_pos;
319319
}
320320

321-
ERR_FAIL_INDEX_V_MSG(p_pos, _p->array.size(), ERR_INVALID_PARAMETER, vformat("The calculated index %d is out of bounds (the array has %d elements). Leaving the array untouched.", p_pos, _p->array.size()));
321+
ERR_FAIL_INDEX_V_MSG(p_pos, _p->array.size() + 1, ERR_INVALID_PARAMETER, vformat("The calculated index %d is out of bounds (the array has %d elements). Leaving the array untouched.", p_pos, _p->array.size()));
322322

323323
return _p->array.insert(p_pos, std::move(value));
324324
}

0 commit comments

Comments
 (0)