mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Avoid NPE while reformating on a default project (IDEA-194581)
This commit is contained in:
@@ -198,7 +198,8 @@ public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
|
||||
Project project = psiFile.getProject();
|
||||
if (virtualFile.isInLocalFileSystem() || virtualFile.getFileSystem() instanceof NonPhysicalFileSystem) {
|
||||
// Try to find editor for the real file.
|
||||
final FileEditor[] editors = FileEditorManager.getInstance(project).getEditors(virtualFile);
|
||||
FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);
|
||||
final FileEditor[] editors = fileEditorManager != null ? fileEditorManager.getEditors(virtualFile) : new FileEditor[0];
|
||||
for (FileEditor editor : editors) {
|
||||
if (editor instanceof TextEditor) {
|
||||
return ((TextEditor)editor).getEditor();
|
||||
|
||||
Reference in New Issue
Block a user