Skip to content

Commit

Permalink
NPE resolved, fixes #1126
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Sep 18, 2017
1 parent c83476d commit 4fbc0d6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/org/rascalmpl/interpreter/result/AbstractFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import org.rascalmpl.interpreter.utils.LimitedResultWriter;
import org.rascalmpl.interpreter.utils.LimitedResultWriter.IOLimitReachedException;
import org.rascalmpl.interpreter.utils.Names;
import org.rascalmpl.uri.URIUtil;

import io.usethesource.vallang.IAnnotatable;
import io.usethesource.vallang.IConstructor;
import io.usethesource.vallang.IExternalValue;
Expand Down Expand Up @@ -94,8 +96,9 @@ public AbstractFunction(AbstractAST ast, IEvaluator<Result<IValue>> eval, Functi

@Override
public IConstructor encodeAsConstructor() {
return getValueFactory().constructor(RascalValueFactory.Function_Function,
getAst().getLocation());
AbstractAST ast2 = getAst();
return getValueFactory().constructor(RascalValueFactory.Function_Function,
ast2 != null ? ast2.getLocation() : URIUtil.correctLocation("unknown", "", ""));
}

protected static List<KeywordFormal> getFormals(FunctionDeclaration func) {
Expand Down

0 comments on commit 4fbc0d6

Please sign in to comment.