From c1ff106a16c872653cc5d0d6c8e1d571fa69d823 Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 17 Jul 2023 13:09:55 +0100 Subject: [PATCH] Fix null error when looking for bots id in enemies list - check key object instead of value Set result to true and don't perform original function, no need --- project/Aki.Custom/Patches/IsEnemyPatch.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/project/Aki.Custom/Patches/IsEnemyPatch.cs b/project/Aki.Custom/Patches/IsEnemyPatch.cs index 54bfd01..273ed3d 100644 --- a/project/Aki.Custom/Patches/IsEnemyPatch.cs +++ b/project/Aki.Custom/Patches/IsEnemyPatch.cs @@ -50,9 +50,11 @@ namespace Aki.Custom.Patches } // Check existing enemies list - if (!__instance.Enemies.IsNullOrEmpty() && __instance.Enemies.Any(x=> x.Value.Player.Id == requester.Id)) + // Could also check x.Value.Player?.Id - BSG do it this way + if (!__instance.Enemies.IsNullOrEmpty() && __instance.Enemies.Any(x=> x.Key.Id == requester.Id)) { - isEnemy = true; + __result = true; + return true; } else {