summaryrefslogtreecommitdiff
path: root/core/array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/array.cpp')
-rw-r--r--core/array.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/array.cpp b/core/array.cpp
index a334af2c04..108d9f7386 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -133,18 +133,12 @@ void Array::erase(const Variant &p_value) {
}
Variant Array::front() const {
- if (_p->array.size() == 0) {
- ERR_EXPLAIN("Can't take value from empty array");
- ERR_FAIL_V(Variant());
- }
+ ERR_FAIL_COND_V_MSG(_p->array.size() == 0, Variant(), "Can't take value from empty array.");
return operator[](0);
}
Variant Array::back() const {
- if (_p->array.size() == 0) {
- ERR_EXPLAIN("Can't take value from empty array");
- ERR_FAIL_V(Variant());
- }
+ ERR_FAIL_COND_V_MSG(_p->array.size() == 0, Variant(), "Can't take value from empty array.");
return operator[](_p->array.size() - 1);
}