Merge pull request #20434 from ShoyuVanilla/diag-fix-again

fix: Panic while trying to clear old diagnostics while there's nothing
This commit is contained in:
Shoyu Vanilla (Flint) 2025-08-11 15:35:38 +00:00 committed by GitHub
commit 9db05508ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,7 +105,7 @@ impl DiagnosticCollection {
flycheck_id: usize,
generation: DiagnosticsGeneration,
) {
if self.check[flycheck_id].generation < generation {
if self.check.get(flycheck_id).is_some_and(|it| it.generation < generation) {
self.clear_check(flycheck_id);
}
}