Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/rust-analyzer/src/handlers/notification.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs
index 09b6794e4f..ddef716c51 100644
--- a/crates/rust-analyzer/src/handlers/notification.rs
+++ b/crates/rust-analyzer/src/handlers/notification.rs
@@ -336,7 +336,9 @@ fn run_flycheck(state: &mut GlobalState, vfs_path: VfsPath) -> bool {
"should have exactly one flycheck handle when invocation strategy is once"
);
let saved_file = vfs_path.as_path().map(ToOwned::to_owned);
- world.flycheck[0].restart_workspace(saved_file);
+ if let Some(flycheck) = world.flycheck.first() {
+ flycheck.restart_workspace(saved_file);
+ }
Ok(())
})
}