[R-Editor] Fix NPE in RContextInformationValidator
Change-Id: Ib12153d594ef07f2dcf595c345fd1ba4d7ef661e
diff --git a/r/org.eclipse.statet.r.ui/src/org/eclipse/statet/internal/r/ui/editors/RContextInformationValidator.java b/r/org.eclipse.statet.r.ui/src/org/eclipse/statet/internal/r/ui/editors/RContextInformationValidator.java
index 026d905..a42f169 100644
--- a/r/org.eclipse.statet.r.ui/src/org/eclipse/statet/internal/r/ui/editors/RContextInformationValidator.java
+++ b/r/org.eclipse.statet.r.ui/src/org/eclipse/statet/internal/r/ui/editors/RContextInformationValidator.java
@@ -192,35 +192,40 @@
private RAsts.FCallArgMatch matchArgs(final FCall.Args argsNode) {
final RArgumentListContextInformation info= nonNullAssert(this.info);
+ // assert info.getArgsDefinition() != null
- final FCall fCallNode= info.getFCallNode();
// like org.eclipse.statet.r.core.rsource.ast.RAsts#matchArgs(FCall, ArgsDefinition)
@Nullable RAstNode replValueArg= null;
ImList<@Nullable RAstNode> inject0Args= ImCollections.emptyList();
- final RAstNode parentNode= fCallNode.getRParent();
- if (parentNode != null) {
- switch (parentNode.getNodeType()) {
- case PIPE_FORWARD:
- { final Pipe pipeNode= (Pipe)parentNode;
- if (pipeNode.getTargetChild() == fCallNode) {
- inject0Args= ImCollections.newList(pipeNode.getSourceChild());
+ final FCall fCallNode= info.getFCallNode();
+ if (fCallNode != null) {
+ final RAstNode parentNode= fCallNode.getRParent();
+ if (parentNode != null) {
+ switch (parentNode.getNodeType()) {
+ case PIPE_FORWARD:
+ { final Pipe pipeNode= (Pipe)parentNode;
+ if (pipeNode.getTargetChild() == fCallNode) {
+ inject0Args= ImCollections.newList(pipeNode.getSourceChild());
+ }
+ break;
}
+ case A_LEFT:
+ case A_EQUALS:
+ case A_RIGHT:
+ { final Assignment assignNode= (Assignment)parentNode;
+ if (assignNode.getTargetChild() == fCallNode) {
+ replValueArg= assignNode.getSourceChild();
+ }
+ break;
+ }
+ default:
break;
}
- case A_LEFT:
- case A_EQUALS:
- case A_RIGHT:
- { final Assignment assignNode= (Assignment)parentNode;
- if (assignNode.getTargetChild() == fCallNode) {
- replValueArg= assignNode.getSourceChild();
- }
- break;
- }
- default:
- break;
}
}
- return RAsts.matchArgs(argsNode, info.getArgsDefinition(), replValueArg, inject0Args);
+
+ final var argsDefinition= nonNullAssert(info.getArgsDefinition());
+ return RAsts.matchArgs(argsNode, argsDefinition, replValueArg, inject0Args);
}