Description
Hello,
We had an ios 18.0 beta 4
sysdiag that made this lib panic! (@ReturnRei will perhaps provide more details)
I quick fixed it in this commit :
shindan-io@fc30ecf
But I find my fix just ugly, i'm far from confident in the existing code.
The code heavy rely on array[index]
indexers, which can panic!
.
On other way could be to forget about indexers and use the array.get(index)
that returns an Option
and let us all the semantics to handle the missing case properly.
Same goes with subslicing, slice[x..]
could be replaced by get(x..)
too.
let array = &vec![1, 2, 3, 4, 5];
let _will_panic = array[42]; // will panic
let _ok = array.get(42); // returns Option::None
let _will_panic = &array[42..]; // will panic
let _ok = array.get(42..); // returns Option::None
Are you aware if this ?
Do you think it's a flaw and that needs some fixing effort ?
Can we help ?
(I can submit a PR with my quick fix, but as said, I think it's a far more general problem and perhaps we should fix it for good)