From e67ea04d92f04d15e0e33d41e000a9d22cc21049 Mon Sep 17 00:00:00 2001 From: Greg Estren Date: Tue, 4 Oct 2016 19:37:26 +0000 Subject: Fix NullPointerException on "select({}) + " clauses. It's fine for these to fail, since "select({})" is by definition unresolvable (and type non-inferrable). But the error should be clear. -- MOS_MIGRATED_REVID=135138890 --- src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java b/src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java index f8a81024ca..7ff2e8bc2a 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java @@ -48,7 +48,8 @@ public final class SelectorValue implements SkylarkValue { public SelectorValue(Map dictionary, String noMatchError) { // Put the dict through a sorting to avoid depending on insertion order. this.dictionary = ImmutableMap.copyOf(new TreeMap<>(dictionary)); - this.type = dictionary.isEmpty() ? null : Iterables.get(dictionary.values(), 0).getClass(); + this.type = + dictionary.isEmpty() ? Object.class : Iterables.get(dictionary.values(), 0).getClass(); this.noMatchError = noMatchError; } -- cgit v1.2.3