mirror of
https://github.com/danbulant/nushell
synced 2026-06-06 08:10:54 +00:00
Make sure we have text before json parse (#4697)
This commit is contained in:
parent
88d7b50e37
commit
fd88920a9d
1 changed files with 4 additions and 0 deletions
|
|
@ -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 a new issue