Skip to content

Commit

Permalink
Null check
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornhusberg committed Oct 24, 2024
1 parent d10c412 commit 0069604
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ private String determineContentEncodingToApply(ChannelHandlerContext ctx, int st
}

private <T, R> R ifType(Object obj, Class<T> type, Function<T, R> then) {
if (type.isAssignableFrom(obj.getClass())) {
return then.apply(type.cast(obj));
}
return null;
return obj != null && type.isAssignableFrom(obj.getClass()) ? then.apply(type.cast(obj)) : null;
}

@Override
Expand Down

0 comments on commit 0069604

Please sign in to comment.