Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit fe1e962

Browse files
chetanmehsinwe
authored andcommitted
Use Option instead of null check
1 parent e0e4f7f commit fe1e962

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/scala/reactor/core/scala/publisher/SMono.scala

+4-2
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,10 @@ trait SMono[T] extends SMonoLike[T, SMono] with MapablePublisher[T] with ScalaCo
13001300
final def toFuture: Future[T] = {
13011301
val promise = Promise[T]()
13021302
coreMono.toFuture.handle[Unit]((value: T, throwable: Throwable) => {
1303-
if (throwable == null) promise.complete(Success(value))
1304-
else promise.failure(throwable)
1303+
Option(throwable) match {
1304+
case Some(_) => promise.failure(throwable)
1305+
case None => promise.complete(Success(value))
1306+
}
13051307
()
13061308
})
13071309
promise.future

0 commit comments

Comments
 (0)