From fff008b4d448fc28c0646641cbfa9f0df2da81ed Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Thu, 12 Feb 2026 13:09:27 +0100 Subject: [PATCH] IJPL-207762 cleanup CodeCompletionHandlerBase GitOrigin-RevId: bf5bf9387e49a1301468f4b045e6183eb42d1a1f --- .../codeInsight/completion/CodeCompletionHandlerBase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index ff1b395c4384..9e85fdcf1587 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -219,7 +219,8 @@ public class CodeCompletionHandlerBase { boolean hasValidContext = context != null; if (!hasValidContext) { - PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(caret, project); + PsiFile psiFile = Objects.requireNonNull(PsiUtilBase.getPsiFileInEditor(caret, project), + "PsiFile must exist here, otherwise completion won't even come here"); context = new CompletionInitializationContextImpl(editor, caret, psiFile, completionType, effectiveInvocationCount); } @@ -629,7 +630,8 @@ public class CodeCompletionHandlerBase { context = lastContext.get(); } else { - PsiFile psiFile = PsiUtilBase.getPsiFileInEditor(editor, project); + PsiFile psiFile = Objects.requireNonNull(PsiUtilBase.getPsiFileInEditor(editor, project), + "PsiFile must exist here, otherwise completion won't even come here"); context = insertItem(items, item, completionChar, editor, psiFile, caretOffset, idEndOffset, offsetMap); } return context;