Skip to content

Commit

Permalink
Tentative nullref fix for LogSource (#7078)
Browse files Browse the repository at this point in the history
* Tenative nullref fix on LogSource

* Simplify FromActorRef() method

---------

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
  • Loading branch information
ilmax and Arkatufus authored Jan 31, 2024
1 parent e78a805 commit 46d6711
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/core/Akka/Event/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,8 @@ public static string FromActor(IActorContext actor, ActorSystem system)

public static string FromActorRef(IActorRef a, ActorSystem system)
{
try
{
return a.Path.ToStringWithAddress(system.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress);
}
catch // can fail if the ActorSystem (remoting) is not completely started yet
{
return a.Path.ToString();
}
var defaultAddress = system.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress;
return defaultAddress is null ? a.Path.ToString() : a.Path.ToStringWithAddress(defaultAddress);
}
}

Expand Down

0 comments on commit 46d6711

Please sign in to comment.