This is an automated email from the ASF dual-hosted git repository.
matthiasblaesing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 48c5b0f Prevent NullPointerException in CPP LanguageServerImpl
new 89d2907 Merge pull request #3191 from
matthiasblaesing/cpplite_incomplete_configuration
48c5b0f is described below
commit 48c5b0f71f117403aae27475809aa759ca82c006
Author: Matthias Bläsing <[email protected]>
AuthorDate: Sat Sep 25 22:34:54 2021 +0200
Prevent NullPointerException in CPP LanguageServerImpl
There are various scenarios where the start routine for the language
server could result in a null value. If on that value Pair#second is
called, this results in a direct NullPointerException being raised.
The value needs to be checked first before the #second invocation is
done.
---
.../netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java
b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java
index 6e73272..06f4dc5 100644
---
a/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java
+++
b/cpplite/cpplite.editor/src/org/netbeans/modules/cpplite/editor/lsp/LanguageServerImpl.java
@@ -89,7 +89,7 @@ public class LanguageServerImpl implements
LanguageServerProvider {
String ccls = Utils.getCCLSPath();
String clangd = Utils.getCLANGDPath();
if (ccls != null || clangd != null) {
- return prj2Server.compute(prj, (p, pair) -> {
+ Pair<Process, LanguageServerDescription> serverEntry =
prj2Server.compute(prj, (p, pair) -> {
if (pair != null && pair.first().isAlive()) {
return pair;
}
@@ -139,7 +139,11 @@ public class LanguageServerImpl implements
LanguageServerProvider {
LOG.log(Level.FINE, null, ex);
return null;
}
- }).second();
+ });
+ if(serverEntry != null) {
+ return serverEntry.second();
+ }
+ return null;
}
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists