check to make sure we have data first (#4484)

This commit is contained in:
Darren Schroeder 2022-02-15 15:08:11 -06:00 committed by GitHub
parent 56b3fc61a3
commit f11fa99d30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -138,6 +138,13 @@ pub fn sort(
insensitive: bool,
config: &Config,
) -> Result<(), ShellError> {
if vec.is_empty() {
return Err(ShellError::LabeledError(
"no values to work with".to_string(),
"no values to work with".to_string(),
));
}
match &vec[0] {
Value::Record {
cols,