diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-24 21:53:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-24 21:53:31 +0200 |
commit | dd3e17588eab8fe0c41fa11f4d33c3fbe5f6dc94 (patch) | |
tree | 830d9b0d973934eb33ff87496715842e0db35fb8 | |
parent | 0c3335d1f3e83c5a95ceb93bb84da776e3fb7e63 (diff) | |
parent | 46e1c0670ec1e2f95a00f9f7f74e549ce57fe201 (diff) |
Merge pull request #32317 from KoBeWi/just_dont
Don't try to slice empty arrays
-rw-r--r-- | core/array.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/array.cpp b/core/array.cpp index ac30df08bc..fd507f46c3 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -240,6 +240,9 @@ int Array::_clamp_index(int p_index) const { Array Array::slice(int p_begin, int p_end, int p_step, bool p_deep) const { // like python, but inclusive on upper bound Array new_arr; + if (empty()) // Don't try to slice empty arrays. + return new_arr; + p_begin = Array::_fix_slice_index(p_begin, size(), -1); // can't start out of range p_end = Array::_fix_slice_index(p_end, size(), 0); |