aboutsummaryrefslogtreecommitdiff
path: root/core/dvector.h
diff options
context:
space:
mode:
authorPedro J. Estébanez2017-05-26 21:11:16 +0200
committerPedro J. Estébanez2017-07-05 09:31:44 +0200
commit211c4518903d82068c061943064824ac5595fd38 (patch)
tree5c332554f6df617d5d9d9eb81f1e471517231fbf /core/dvector.h
parent9fa4f1c54c6d528192e7ed04354d5ce2c733d99a (diff)
downloadgodot-211c4518903d82068c061943064824ac5595fd38.tar.gz
godot-211c4518903d82068c061943064824ac5595fd38.tar.zst
godot-211c4518903d82068c061943064824ac5595fd38.zip
Diffstat (limited to 'core/dvector.h')
-rw-r--r--core/dvector.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/core/dvector.h b/core/dvector.h
index 2e951b966..96cbd2cde 100644
--- a/core/dvector.h
+++ b/core/dvector.h
@@ -403,14 +403,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;
@@ -500,13 +495,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];
}