[problems-view] IJPL-250021 add guard for file validity during quick-fix retrieval

problem events get emitted to a flow, and are then processed into dtos and sent to the fe. if the file corresponding to the problem gets deleted during the (possibly slow) processing of the events, there is a small window between:
 - the file getting deleted, and
 - the cancellation of the coroutine scope associated with that file

 in which we try to get the `PsiFile` associated with it, and that is an invalid operation

GitOrigin-RevId: 224594f181164b1addbb1498cbed9cf0810ab6e3
This commit is contained in:
Marina Mădăraș
2026-07-28 10:36:59 +00:00
committed by intellij-monorepo-bot
parent 40b58b3b77
commit b929b32e85
@@ -123,6 +123,8 @@ internal suspend fun buildProblemDto(problem: Problem, lifetime: ProblemLifetime
}
private suspend fun getQuickFixesOfProblem(problem: HighlightingProblem): List<IntentionActionWithOptions> = readAction {
if (!problem.file.isValid) return@readAction emptyList()
val psiFile = PsiManager.getInstance(problem.provider.project).findFile(problem.file)
if (psiFile == null) return@readAction emptyList()