diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c83a8a..9197d12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ - Configuration changes are now correctly tracked with the pull-model, and the server should correctly update most settings without a restart on config change. +- Fixed issue where server could crash in rare cases when opening a file ## 0.9.9 - Fixed an issue that could cause analysis thread crash when an object was declared both diff --git a/src/actions/mod.rs b/src/actions/mod.rs index 8983546..e1fca22 100644 --- a/src/actions/mod.rs +++ b/src/actions/mod.rs @@ -370,12 +370,13 @@ impl InitActionContext { } fn add_direct_open(&self, path: PathBuf) { - let canon_path: CanonPath = path.into(); + // NOTE: from_path_buf already logs the error, no need to do it here + let Some(canon_path) = CanonPath::from_path_buf(path) else { return }; self.direct_opens.lock().unwrap().insert(canon_path); } fn remove_direct_open(&self, path: PathBuf) { - let canon_path: CanonPath = path.into(); + let Some(canon_path) = CanonPath::from_path_buf(path) else { return }; if !self.direct_opens.lock().unwrap().remove(&canon_path) { debug!("Tried to remove a directly opened file ({:?}) \ that wasnt tracked", canon_path);