aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Greg Estren <gregce@google.com>2016-10-04 19:37:26 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-10-05 12:26:09 +0000
commite67ea04d92f04d15e0e33d41e000a9d22cc21049 (patch)
treec207906f0b37ec5bd1af74cff8be4b4e8a248779
parentc2bcf1cd7bfb7ad70baf87eb943964657b9c6f4a (diff)
Fix NullPointerException on "select({}) + <something else>" 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
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/SelectorValue.java3
1 files changed, 2 insertions, 1 deletions
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;
}