Skip to content

Commit

Permalink
Fix missing null checks in DataProviderRegistrator (#3522)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lignium authored Oct 9, 2021
1 parent db5023f commit dc76a33
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ protected Value<E> constructValue(final H dataHolder, final E element) {

@Override
protected Optional<E> getFrom(final H dataHolder) {
if (registration.get == null) {
return Optional.empty();
}
if (this.isBooleanKey) {
return (Optional<E>) OptBool.of((Boolean) registration.get.apply(dataHolder));
}
Expand Down Expand Up @@ -487,6 +490,9 @@ protected Value<E> constructValue(final H dataHolder, final E element) {

@Override
protected Optional<E> getFrom(final H dataHolder) {
if (registration.get == null) {
return Optional.empty();
}
if (this.isBooleanKey) {
return (Optional<E>) OptBool.of((Boolean) registration.get.apply(dataHolder));
}
Expand All @@ -495,6 +501,9 @@ protected Optional<E> getFrom(final H dataHolder) {

@Override
protected Optional<H> set(final H dataHolder, final E value) {
if (registration.set == null) {
return Optional.empty();
}
return Optional.ofNullable(registration.set.apply(dataHolder, value));
}

Expand Down

0 comments on commit dc76a33

Please sign in to comment.