From cb67d66a1c61d9577c15a5c495559e3abb3472b8 Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Thu, 18 Jul 2024 13:47:32 +0800 Subject: [PATCH 1/2] fix: only setFailed when actor not null --- actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala index 63af89af0cd..01ea2873e72 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala @@ -661,8 +661,7 @@ private[pekko] class ActorCell( Thread.currentThread().interrupt() throw ActorInitializationException(self, "interruption during creation", e) case NonFatal(e) => - if (actor == null) setFailed(system.deadLetters) - else setFailed(actor.self) + if (actor != null) setFailed(actor.self) failActor() e match { case i: InstantiationException => From 7c80c1f005560e21f80eeeeafa99aecdfafe704c Mon Sep 17 00:00:00 2001 From: "Andy.Chen" Date: Thu, 18 Jul 2024 14:24:32 +0800 Subject: [PATCH 2/2] chore: use ne rather than != --- actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala index 01ea2873e72..26131a979cc 100644 --- a/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala +++ b/actor/src/main/scala/org/apache/pekko/actor/ActorCell.scala @@ -661,7 +661,7 @@ private[pekko] class ActorCell( Thread.currentThread().interrupt() throw ActorInitializationException(self, "interruption during creation", e) case NonFatal(e) => - if (actor != null) setFailed(actor.self) + if (actor ne null) setFailed(actor.self) failActor() e match { case i: InstantiationException =>