Skip to content

Commit

Permalink
Add null check for 'fCollapsedTypes' variable to avoid NPE when invok…
Browse files Browse the repository at this point in the history
…ing completion in DEBUG CONSOLE (#3086)
  • Loading branch information
testforstephen committed Mar 6, 2024
1 parent 4bb0cb6 commit 4b2b504
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ private void createMethodProposalLabel(CompletionProposal methodProposal, Comple
String proposalName = String.valueOf(methodProposal.getName());
boolean skipDetail = false;
if (isCompletionItemLabelDetailsSupport()){
if (fCollapsedTypes.getOrDefault(proposalName, 0) > 1 && methodProposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION) {
if (fCollapsedTypes != null && fCollapsedTypes.getOrDefault(proposalName, 0) > 1 && methodProposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION) {
setLabelDetails(item, proposalName, "(...)", fCollapsedTypes.get(proposalName).toString() + " overloads");
skipDetail = true;
} else {
Expand All @@ -348,7 +348,7 @@ private void createMethodProposalLabel(CompletionProposal methodProposal, Comple
}
}
} else {
if (fCollapsedTypes.getOrDefault(proposalName, 0) > 1 && methodProposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION) {
if (fCollapsedTypes != null && fCollapsedTypes.getOrDefault(proposalName, 0) > 1 && methodProposal.getKind() != CompletionProposal.CONSTRUCTOR_INVOCATION) {
item.setLabel(proposalName + "(...)");
item.setDetail(fCollapsedTypes.get(proposalName).toString() + " overloads");
skipDetail = true;
Expand Down

0 comments on commit 4b2b504

Please sign in to comment.