BurntSushi / xsv

A fast CSV command line toolkit written in Rust.
The Unlicense
10.29k stars 317 forks source link

Selector index 1 is out of bounds. Index must be >= 1 and <= 0. #286

Open d33tah opened 2 years ago

d33tah commented 2 years ago

Consider the output of the following command:

$ cat /dev/null | xsv select 1
Selector index 1 is out of bounds. Index must be >= 1 and <= 0.

This might happen in practice when xsv is being fed data from a broken script. It looks like this is the relevant piece of code:

https://github.com/BurntSushi/xsv/blob/3de6c04269a7d315f7e9864b9013451cd9580a08/src/select.rs#L315

Perhaps it would make sense to catch this specific error case and throw an error like "input file is empty"?