Skip to content

Commit 7e2123b

Browse files
cdracmintellij-monorepo-bot
authored andcommitted
remove unnecessary editor.getProject() which might NPE
GitOrigin-RevId: 6b16214970857b781dd0ae1eeccbe8fe3475d289
1 parent 1c4c98b commit 7e2123b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

java/java-analysis-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public AddAnnotationFix(@NotNull String fqn,
4949

5050
@Override
5151
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
52-
if (InjectedLanguageManager.getInstance(editor.getProject()).isInjectedFragment(file)) {
52+
if (InjectedLanguageManager.getInstance(project).isInjectedFragment(file)) {
5353
PsiElement psiElement = getStartElement();
5454
if (psiElement == null || psiElement.getContainingFile() != file) return false;
5555
}

platform/analysis-impl/src/com/intellij/codeInspection/ex/QuickFixWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public String toString() {
198198

199199
@Override
200200
public @NotNull List<@NotNull RangeToHighlight> getRangesToHighlight(@NotNull Editor editor, @NotNull PsiFile file) {
201-
return myFix.getRangesToHighlight(editor.getProject(), myDescriptor);
201+
return myFix.getRangesToHighlight(file.getProject(), myDescriptor);
202202
}
203203

204204
private static class ModCommandQuickFixAction implements ModCommandAction {

platform/platform-impl/src/com/intellij/formatting/LineWrappingUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static void doWrapLongLinesIfNecessary(@NotNull final Editor editor, @Not
127127

128128
// We know that current line exceeds right margin if control flow reaches this place, so, wrap it.
129129
int wrapOffset = strategy.calculateWrapPosition(
130-
document, editor.getProject(), Math.max(startLineOffset, startOffsetToUse), Math.min(endLineOffset, endOffsetToUse),
130+
document, project, Math.max(startLineOffset, startOffsetToUse), Math.min(endLineOffset, endOffsetToUse),
131131
preferredWrapPosition, false, false
132132
);
133133
if (wrapOffset < 0 // No appropriate wrap position is found.
@@ -195,7 +195,7 @@ private static void emulateEnter(@NotNull final Editor editor, @NotNull Project
195195
Runnable command = () -> EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER)
196196
.execute(editor, editor.getCaretModel().getCurrentCaret(), dataContext);
197197
if (commandProcessor.getCurrentCommand() == null) {
198-
commandProcessor.executeCommand(editor.getProject(), command, WRAP_LINE_COMMAND_NAME, null);
198+
commandProcessor.executeCommand(project, command, WRAP_LINE_COMMAND_NAME, null);
199199
}
200200
else {
201201
command.run();

0 commit comments

Comments
 (0)