From effd1b71ce0bdd806db9116afd853029141f6735 Mon Sep 17 00:00:00 2001 From: Windy Darian Date: Sat, 12 Apr 2025 22:11:53 -0400 Subject: [PATCH] allow inserting at end of array again --- core/variant/array.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 81caa5d1474..0c9e36ea28e 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -318,7 +318,7 @@ Error Array::insert(int p_pos, const Variant &p_value) { p_pos = _p->array.size() + p_pos; } - 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())); + 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())); return _p->array.insert(p_pos, std::move(value)); }