GH-1239: prevent NPE when no symbols are around yet
This commit is contained in:
@@ -600,21 +600,24 @@ public class SpringSymbolIndex implements InitializingBean, SpringIndex {
|
||||
|
||||
private Collection<? extends String> getDocsFromPath(IJavaProject project, String path) {
|
||||
List<EnhancedSymbolInformation> allProjectSymbols = this.symbolsByProject.get(project.getElementName());
|
||||
Set<String> result = new HashSet<>();
|
||||
|
||||
for (EnhancedSymbolInformation symbol : allProjectSymbols) {
|
||||
Either<Location, WorkspaceSymbolLocation> location = symbol.getSymbol().getLocation();
|
||||
Set<String> result = new HashSet<>();
|
||||
|
||||
String docURI = null;
|
||||
if (location.isLeft()) {
|
||||
docURI = location.getLeft().getUri();
|
||||
}
|
||||
else if (location.isRight()) {
|
||||
docURI = location.getRight().getUri();
|
||||
}
|
||||
|
||||
if (docURI != null && docURI.startsWith(path)) {
|
||||
result.add(docURI);
|
||||
if (allProjectSymbols != null) {
|
||||
for (EnhancedSymbolInformation symbol : allProjectSymbols) {
|
||||
Either<Location, WorkspaceSymbolLocation> location = symbol.getSymbol().getLocation();
|
||||
|
||||
String docURI = null;
|
||||
if (location.isLeft()) {
|
||||
docURI = location.getLeft().getUri();
|
||||
}
|
||||
else if (location.isRight()) {
|
||||
docURI = location.getRight().getUri();
|
||||
}
|
||||
|
||||
if (docURI != null && docURI.startsWith(path)) {
|
||||
result.add(docURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user