aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Vladimir Moskva <vladmos@google.com>2016-09-02 15:39:17 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-09-06 15:37:54 +0000
commit658a8eae9550bb6daf16eb24e1bc56c015a819c2 (patch)
treef71f0cef827bb7d6fab47a0f61e040bc98f635a9 /src/main/java/com/google/devtools/build
parent4689c5d1d2faf902846b100b8d858d172a0ceb3d (diff)
Fixed NPEs when using built in functions as rule implementations
-- MOS_MIGRATED_REVID=132066368
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
index 533928c9c2..b3a763fd41 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/BuiltinFunction.java
@@ -122,9 +122,10 @@ public class BuiltinFunction extends BaseFunction {
public Object call(Object[] args,
FuncallExpression ast, Environment env)
throws EvalException, InterruptedException {
- Preconditions.checkNotNull(ast);
Preconditions.checkNotNull(env);
- Location loc = ast.getLocation();
+
+ // ast is null when called from Java (as there's no Skylark call site).
+ Location loc = ast == null ? Location.BUILTIN : ast.getLocation();
// Add extra arguments, if needed
if (extraArgs != null) {