diff options
Diffstat (limited to 'zellij-utils/src/input/layout.rs')
-rw-r--r-- | zellij-utils/src/input/layout.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index 033614151..2bbc8cb48 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -161,7 +161,17 @@ impl LayoutFromYaml { let mut layout = String::new(); layout_file.read_to_string(&mut layout)?; - let layout: Option<LayoutFromYaml> = serde_yaml::from_str(&layout)?; + let layout: Option<LayoutFromYaml> = match serde_yaml::from_str(&layout) { + Err(e) => { + // needs direct check, as `[ErrorImpl]` is private + // https://github.com/dtolnay/serde-yaml/issues/121 + if layout.is_empty() { + return Ok(LayoutFromYaml::default()); + } + return Err(ConfigError::Serde(e)); + } + Ok(config) => config, + }; match layout { Some(layout) => { |