mirror of
https://github.com/nushell/nushell.git
synced 2025-04-07 18:55:30 +02:00
Make sure we have text before json parse (#4697)
This commit is contained in:
parent
88d7b50e37
commit
fd88920a9d
@ -78,6 +78,10 @@ impl Command for FromJson {
|
|||||||
let config = stack.get_config().unwrap_or_default();
|
let config = stack.get_config().unwrap_or_default();
|
||||||
let string_input = input.collect_string("", &config)?;
|
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
|
// TODO: turn this into a structured underline of the nu_json error
|
||||||
if call.has_flag("objects") {
|
if call.has_flag("objects") {
|
||||||
#[allow(clippy::needless_collect)]
|
#[allow(clippy::needless_collect)]
|
||||||
|
Loading…
Reference in New Issue
Block a user