fix NPE in case the bean type cannot be found

This commit is contained in:
Martin Lippert
2019-04-24 11:56:18 +02:00
parent 7cc31ade11
commit 27fcf9787a

View File

@@ -59,15 +59,17 @@ public class PropertyNameCompletionProposalProvider implements XMLCompletionProv
}
String beanClass = identifyBeanClass(node);
if (beanClass != null) {
if (beanClass != null && beanClass.length() > 0) {
IType beanType = project.getIndex().findType(beanClass);
final String searchPrefix = prefix;
return beanType.getMethods()
.filter(method -> isPropertyWriteMethod(method))
.filter(method -> getPropertyName(method).startsWith(searchPrefix))
.map(method -> createProposal(method, doc, offset, tokenOffset, tokenEnd))
.collect(Collectors.toList());
if (beanType != null) {
final String searchPrefix = prefix;
return beanType.getMethods()
.filter(method -> isPropertyWriteMethod(method))
.filter(method -> getPropertyName(method).startsWith(searchPrefix))
.map(method -> createProposal(method, doc, offset, tokenOffset, tokenEnd))
.collect(Collectors.toList());
}
}
};