Skip to content

Commit 3748fcd

Browse files
committed
fix(api): Skip mapping of null values in matchers
1 parent cc8853f commit 3748fcd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

silo-api/src/main/java/se/l4/silo/internal/EqualsMatcherImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public V getValue()
3030
@Override
3131
public <NV> Matcher<NV> map(Function<V, NV> func)
3232
{
33-
return new EqualsMatcherImpl<>(func.apply(value));
33+
return new EqualsMatcherImpl<>(value == null ? null : func.apply(value));
3434
}
3535

3636
@Override

silo-api/src/main/java/se/l4/silo/internal/RangeMatcherImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public boolean isUpperInclusive()
5959
public <NV> Matcher<NV> map(Function<T, NV> func)
6060
{
6161
return new RangeMatcherImpl<>(
62-
func.apply(lower),
62+
lower == null ? null : func.apply(lower),
6363
lowerInclusive,
64-
func.apply(upper),
64+
upper == null ? null : func.apply(upper),
6565
upperInclusive
6666
);
6767
}

0 commit comments

Comments
 (0)