diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-01 12:16:26 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-01 12:16:33 +0200 |
commit | 7b7ccf25b67ae6b28bb99b5d54f96cc299ec6b88 (patch) | |
tree | 6df1a7a668ae2b1b3ff49d5df08c0874ca4727e4 /core | |
parent | 7ee419f8d97657df558cd9e0eab4671a36f3c21f (diff) |
LocalVector: Don't error if `from` >= `count`
Vector handles this silently by returning -1, and we should do the same here.
Otherwise we get errors when calling `find()` on e.g. a LocalVector of size 0,
while `find()` is expected to always work (if the parameters are invalid then
it doesn't find anything, so -1).
Fixup to #49925.
Diffstat (limited to 'core')
-rw-r--r-- | core/templates/local_vector.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/core/templates/local_vector.h b/core/templates/local_vector.h index 5fa0f942aa..668ec513d6 100644 --- a/core/templates/local_vector.h +++ b/core/templates/local_vector.h @@ -178,7 +178,6 @@ public: } int64_t find(const T &p_val, U p_from = 0) const { - ERR_FAIL_UNSIGNED_INDEX_V(p_from, count, -1); for (U i = p_from; i < count; i++) { if (data[i] == p_val) { return int64_t(i); |