aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alacritty/src/migrate/mod.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs
index ffd0d4b4..58f381de 100644
--- a/alacritty/src/migrate/mod.rs
+++ b/alacritty/src/migrate/mod.rs
@@ -134,7 +134,11 @@ fn migrate_imports(
recursion_limit: usize,
) -> Result<(), String> {
// Check if any imports need to be processed.
- let imports = match document["general"].get("import").and_then(|i| i.as_array()) {
+ let imports = match document
+ .get("general")
+ .and_then(|general| general.get("import"))
+ .and_then(|import| import.as_array())
+ {
Some(array) if !array.is_empty() => array,
_ => return Ok(()),
};
@@ -315,4 +319,9 @@ root_value = 3
assert_eq!(output, expected);
}
+
+ #[test]
+ fn migrate_empty() {
+ assert!(migrate_toml(String::new()).unwrap().to_string().is_empty());
+ }
}