diff options
| author | Rémi Verschelde | 2017-07-05 10:55:11 +0200 |
|---|---|---|
| committer | GitHub | 2017-07-05 10:55:11 +0200 |
| commit | 6f63a01302355077af2459c96a17e299c32b2960 (patch) | |
| tree | c0c6ed6e20f8dc26b436e9c193a962dbd09ffcb7 /core/dvector.h | |
| parent | 5a48b428fd349411456b785a5cb9a6ee0d5b1506 (diff) | |
| parent | 211c4518903d82068c061943064824ac5595fd38 (diff) | |
| download | godot-6f63a01302355077af2459c96a17e299c32b2960.tar.gz godot-6f63a01302355077af2459c96a17e299c32b2960.tar.zst godot-6f63a01302355077af2459c96a17e299c32b2960.zip | |
Diffstat (limited to 'core/dvector.h')
| -rw-r--r-- | core/dvector.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/core/dvector.h b/core/dvector.h index 4584a300f..66af42f7e 100644 --- a/core/dvector.h +++ b/core/dvector.h @@ -409,14 +409,9 @@ public: if (p_to < 0) { p_to = size() + p_to; } - if (p_from < 0 || p_from >= size()) { - PoolVector<T> &aux = *((PoolVector<T> *)0); // nullreturn - ERR_FAIL_COND_V(p_from < 0 || p_from >= size(), aux) - } - if (p_to < 0 || p_to >= size()) { - PoolVector<T> &aux = *((PoolVector<T> *)0); // nullreturn - ERR_FAIL_COND_V(p_to < 0 || p_to >= size(), aux) - } + + CRASH_BAD_INDEX(p_from, size()); + CRASH_BAD_INDEX(p_to, size()); PoolVector<T> slice; int span = 1 + p_to - p_from; @@ -506,13 +501,9 @@ void PoolVector<T>::push_back(const T &p_val) { template <class T> const T PoolVector<T>::operator[](int p_index) const { - if (p_index < 0 || p_index >= size()) { - T &aux = *((T *)0); //nullreturn - ERR_FAIL_COND_V(p_index < 0 || p_index >= size(), aux); - } + CRASH_BAD_INDEX(p_index, size()); Read r = read(); - return r[p_index]; } |
