Skip to content

Commit

Permalink
Add extra checks for non null in Exceptional
Browse files Browse the repository at this point in the history
  • Loading branch information
aNNiMON committed Mar 21, 2019
1 parent 610c5dd commit 3fbf01d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stream/src/main/java/com/annimon/stream/Exceptional.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class Exceptional<T> {
*/
@NotNull
public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> supplier) {
Objects.requireNonNull(supplier);
try {
return new Exceptional<T>(supplier.get(), null);
} catch (Throwable throwable) {
Expand All @@ -60,6 +61,7 @@ public static <T> Exceptional<T> of(@NotNull ThrowableSupplier<T, Throwable> sup
@NotNull
@Contract("_ -> new")
public static <T> Exceptional<T> of(@NotNull Throwable throwable) {
Objects.requireNonNull(throwable);
return new Exceptional<T>(null, throwable);
}

Expand Down

0 comments on commit 3fbf01d

Please sign in to comment.