Make sure we have text before json parse (#4697)

This commit is contained in:
JT 2022-03-02 15:58:56 -05:00 committed by GitHub
parent 88d7b50e37
commit fd88920a9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,10 @@ impl Command for FromJson {
let config = stack.get_config().unwrap_or_default();
let string_input = input.collect_string("", &config)?;
if string_input.is_empty() {
return Ok(PipelineData::new(span));
}
// TODO: turn this into a structured underline of the nu_json error
if call.has_flag("objects") {
#[allow(clippy::needless_collect)]