Repository: alacritty/alacritty (language: rust)

Issue:
`alacritty migate` panic
Running `alacritty migrate` seems to panic, rather than migrate stuff. It appears to point to this indexing on the toml. https://github.com/alacritty/alacritty/blob/c032c89f1c457c3cf97dcda3f8367115fa5f66ea/alacritty/src/migrate/mod.rs#L137

### System

OS: Linux
Version: alacritty 0.14.0-dev (c032c89f)
Linux/BSD: Arch Linux 6.11.2-arch1-1, Wayland, Hyprland

### Logs

Crashes:

```rs
❯ alacritty migrate
[alacritty/src/migrate/mod.rs:174:9] &key = KeyMut {
    key: Key {
        key: "shell",
        repr: Some(
            "shell",
        ),
        leaf_decor: Decor {
            prefix: empty,
            suffix: empty,
        },
        dotted_decor: Decor {
            prefix: empty,
            suffix: empty,
        },
    },
}
thread 'main' panicked at alacritty/src/migrate/mod.rs:137:33:
index not found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```

Font/Terminal size:
[Alacritty-2712427.log](https://github.com/user-attachments/files/17334656/Alacritty-2712427.log)


Keyboard and bindings:
[Alacritty-2716785.log](https://github.com/user-attachments/files/17334703/Alacritty-2716785.log)




Discussion / hints:
share your configs?
I can repro with an empty config.

Fix patch:
diff --git a/alacritty/src/migrate/mod.rs b/alacritty/src/migrate/mod.rs
index ffd0d4b43a4..58f381de381 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());
+    }
 }


Test patch: