Safeguard against trying to send messages to a vehicle actor that no longer exists

This commit is contained in:
Mazo 2020-05-17 22:04:26 +01:00
parent 0ada64fd44
commit 1092e76348
2 changed files with 2 additions and 2 deletions

View file

@ -309,7 +309,7 @@ class PersistenceMonitor(name : String, squadService : ActorRef, taskResolver :
player.Position = Vector3.Zero
player.Health = 0
inZone.GUID(player.VehicleOwned) match {
case Some(vehicle : Vehicle) if vehicle.OwnerName.contains(player.Name) =>
case Some(vehicle : Vehicle) if vehicle.OwnerName.contains(player.Name) && vehicle.Actor != ActorRef.noSender =>
vehicle.Actor ! Vehicle.Ownership(None)
case _ => ;
}

View file

@ -10199,7 +10199,7 @@ class WorldSessionActor extends Actor
def LoadZoneCommonTransferActivity() : Unit = {
if(player.VehicleOwned.nonEmpty && player.VehicleSeated != player.VehicleOwned) {
continent.GUID(player.VehicleOwned) match {
case Some(vehicle : Vehicle) =>
case Some(vehicle : Vehicle) if vehicle.Actor != ActorRef.noSender =>
vehicle.Actor ! Vehicle.Ownership(None)
case _ => ;
}