MiSawa / xq

Pure rust implementation of jq
MIT License
333 stars 18 forks source link

indices by empty array panics #25

Closed itchyny closed 3 years ago

itchyny commented 3 years ago

Using indices filter with empty array argument panics but should not.

❯ echo '[0]' | jq 'indices([])'                                            
[]

❯ echo '[0]' | xq 'indices([])'
thread 'main' panicked at 'size is zero', /rustc/9dbb26efe8a886f7bba94c2b996c9535ce07f917/library/core/src/slice/mod.rs:753:44
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

❯ xq --version
xq 0.1.4-01d8350a1d5a9f885b2b8b5c1222eb04b742ccb3
MiSawa commented 3 years ago

Gooood catch!!! Thank you for reporting, fixed.