Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2017-11-30 17:51:13 -0500
committerAndrey Loskutov2017-11-30 17:51:13 -0500
commit13f734bdd7951d8b59cfd73ae8cbc2793f76bf0f (patch)
tree23452f01d7063bf8e0233ff2f86511741ed760f0
parentc321f97bf2ad7e675516ee4b44595dd96bddcd96 (diff)
downloadeclipse.platform.text-13f734bdd7951d8b59cfd73ae8cbc2793f76bf0f.tar.gz
eclipse.platform.text-13f734bdd7951d8b59cfd73ae8cbc2793f76bf0f.tar.xz
eclipse.platform.text-13f734bdd7951d8b59cfd73ae8cbc2793f76bf0f.zip
Bug 527978 - NPE in ContentAssistant.computeCompletionProposalsI20171130-2100I20171130-2000
Change-Id: Icabb6d9e3b43a782c1159b52a953d97aacaf6c63 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java5
-rw-r--r--org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java5
3 files changed, 15 insertions, 5 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
index d2cae78bb..071375c2f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AsyncCompletionProposalPopup.java
@@ -269,9 +269,13 @@ class AsyncCompletionProposalPopup extends CompletionProposalPopup {
}
List<CompletableFuture<List<ICompletionProposal>>> futures = new ArrayList<>(processors.size());
for (IContentAssistProcessor processor : processors) {
- futures.add(CompletableFuture.supplyAsync(() ->
- Arrays.asList(processor.computeCompletionProposals(fViewer, invocationOffset))
- ));
+ futures.add(CompletableFuture.supplyAsync(() -> {
+ ICompletionProposal[] proposals= processor.computeCompletionProposals(fViewer, invocationOffset);
+ if (proposals == null) {
+ return Collections.emptyList();
+ }
+ return Arrays.asList(proposals);
+ }));
}
return futures;
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
index b03712c29..bd12c8e71 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
@@ -2013,7 +2013,10 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
@Override
public void run() throws Exception {
processors.forEach(p -> {
- res.addAll(Arrays.asList(p.computeCompletionProposals(viewer, offset)));
+ ICompletionProposal[] proposals= p.computeCompletionProposals(viewer, offset);
+ if (proposals != null) {
+ res.addAll(Arrays.asList(proposals));
+ }
fLastErrorMessage= p.getErrorMessage();
});
}
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
index f3c9a9775..06ca42db1 100644
--- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
+++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/CompositeContentAssistProcessor.java
@@ -46,7 +46,10 @@ public class CompositeContentAssistProcessor implements IContentAssistProcessor
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
List<ICompletionProposal> res = new ArrayList<>();
for (IContentAssistProcessor processor : this.fContentAssistProcessors) {
- res.addAll(Arrays.asList(processor.computeCompletionProposals(viewer, offset)));
+ ICompletionProposal[] proposals = processor.computeCompletionProposals(viewer, offset);
+ if (proposals != null) {
+ res.addAll(Arrays.asList(proposals));
+ }
}
return res.toArray(new ICompletionProposal[res.size()]);
}

Back to the top