diff options
| author | Pedro J. Estébanez | 2017-05-26 21:11:16 +0200 |
|---|---|---|
| committer | Pedro J. Estébanez | 2017-07-05 09:31:44 +0200 |
| commit | 211c4518903d82068c061943064824ac5595fd38 (patch) | |
| tree | 5c332554f6df617d5d9d9eb81f1e471517231fbf /core/vector.h | |
| parent | 9fa4f1c54c6d528192e7ed04354d5ce2c733d99a (diff) | |
| download | godot-211c4518903d82068c061943064824ac5595fd38.tar.gz godot-211c4518903d82068c061943064824ac5595fd38.tar.zst godot-211c4518903d82068c061943064824ac5595fd38.zip | |
Diffstat (limited to 'core/vector.h')
| -rw-r--r-- | core/vector.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/core/vector.h b/core/vector.h index fe1c1b05d..5eed8dce9 100644 --- a/core/vector.h +++ b/core/vector.h @@ -134,10 +134,7 @@ public: inline T &operator[](int p_index) { - 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()); _copy_on_write(); // wants to write, so copy on write. @@ -146,10 +143,8 @@ public: inline const T &operator[](int p_index) const { - if (p_index < 0 || p_index >= size()) { - const T &aux = *((T *)0); //nullreturn - ERR_FAIL_COND_V(p_index < 0 || p_index >= size(), aux); - } + CRASH_BAD_INDEX(p_index, size()); + // no cow needed, since it's reading return _get_data()[p_index]; } |
