diff --git a/Source/Client/AsyncTime/AsyncWorldTimeComp.cs b/Source/Client/AsyncTime/AsyncWorldTimeComp.cs index 7db59bb68..1855aa5a8 100644 --- a/Source/Client/AsyncTime/AsyncWorldTimeComp.cs +++ b/Source/Client/AsyncTime/AsyncWorldTimeComp.cs @@ -50,7 +50,7 @@ public TimeSpeed DesiredTimeSpeed get => !Find.Maps.Any() ? timeSpeedInt : Find.Maps.Select(m => m.AsyncTime()) - .Where(a => a.ActualRateMultiplier(a.DesiredTimeSpeed) != 0f) + .Where(a => a != null && a.ActualRateMultiplier(a.DesiredTimeSpeed) != 0f) .Max(a => a?.DesiredTimeSpeed) ?? TimeSpeed.Paused; set => timeSpeedInt = value; } diff --git a/Source/Client/Factions/Forbiddables.cs b/Source/Client/Factions/Forbiddables.cs index 590e9d58e..8a700ec91 100644 --- a/Source/Client/Factions/Forbiddables.cs +++ b/Source/Client/Factions/Forbiddables.cs @@ -116,7 +116,7 @@ static class ThingDespawnUnsetForbidden static void Prefix(Thing __instance) { if (Multiplayer.Client == null) return; - __instance.Map.MpComp().Notify_ThingDespawned(__instance); + __instance.Map?.MpComp()?.Notify_ThingDespawned(__instance); } } } diff --git a/Source/Client/Patches/TeachingPatches.cs b/Source/Client/Patches/TeachingPatches.cs index dd229f8df..6bafa82cc 100644 --- a/Source/Client/Patches/TeachingPatches.cs +++ b/Source/Client/Patches/TeachingPatches.cs @@ -15,7 +15,7 @@ static bool Prefix(Thing t, ref Job __result) if (!Multiplayer.InInterface) return true; // If target is not pawn, no result - if (t is not Pawn pawn) + if (t is not Pawn pawn || pawn.CurJob == null) return false; // Alternative approach would be to store the current target of the lesson taking pawn in the