mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix NPE in SdkOrLibraryWeigher
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.util.proximity;
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -36,7 +37,8 @@ public class KnownElementWeigher extends ProximityWeigher {
|
||||
if (weigh != null) return weigh;
|
||||
}
|
||||
|
||||
if (!SdkOrLibraryWeigher.isJdkElement(element, location.getProject())) {
|
||||
Project project = location.getProject();
|
||||
if (project == null || !SdkOrLibraryWeigher.isJdkElement(element, project)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class SdkOrLibraryWeigher extends ProximityWeigher {
|
||||
return project == null ? null : isJdkElement(element, project);
|
||||
}
|
||||
|
||||
static boolean isJdkElement(PsiElement element, final Project project) {
|
||||
static boolean isJdkElement(PsiElement element, @NotNull final Project project) {
|
||||
final VirtualFile file = PsiUtilCore.getVirtualFile(element);
|
||||
if (file != null) {
|
||||
List<OrderEntry> orderEntries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file);
|
||||
|
||||
Reference in New Issue
Block a user