diff options
-rw-r--r-- | core/variant/array.cpp | 6 | ||||
-rw-r--r-- | core/variant/array.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 347c6cd82e..c8fc19b43f 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -202,9 +202,9 @@ Error Array::resize(int p_new_size) { return _p->array.resize(p_new_size); } -void Array::insert(int p_pos, const Variant &p_value) { - ERR_FAIL_COND(!_p->typed.validate(p_value, "insert")); - _p->array.insert(p_pos, p_value); +Error Array::insert(int p_pos, const Variant &p_value) { + ERR_FAIL_COND_V(!_p->typed.validate(p_value, "insert"), ERR_INVALID_PARAMETER); + return _p->array.insert(p_pos, p_value); } void Array::erase(const Variant &p_value) { diff --git a/core/variant/array.h b/core/variant/array.h index d8f2402330..92f7b3079a 100644 --- a/core/variant/array.h +++ b/core/variant/array.h @@ -72,7 +72,7 @@ public: void append_array(const Array &p_array); Error resize(int p_new_size); - void insert(int p_pos, const Variant &p_value); + Error insert(int p_pos, const Variant &p_value); void remove(int p_pos); Variant front() const; |