From 2124aed1090907112cfc583ea388f315dcc4b621 Mon Sep 17 00:00:00 2001 From: Jackson <9527380+Jaksuhn@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:43:56 +0000 Subject: [PATCH] get rid of throw --- RotationSolver.Basic/Helpers/ObjectHelper.cs | 3 +-- RotationSolver.Basic/Helpers/StatusHelper.cs | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RotationSolver.Basic/Helpers/ObjectHelper.cs b/RotationSolver.Basic/Helpers/ObjectHelper.cs index 3067752f7..9b52a903a 100644 --- a/RotationSolver.Basic/Helpers/ObjectHelper.cs +++ b/RotationSolver.Basic/Helpers/ObjectHelper.cs @@ -81,9 +81,8 @@ public static unsafe bool IsAlliance(this GameObject obj) } catch (Exception ex) { - // Log or print the exception details for debugging Svc.Log.Error($"Exception in {nameof(IsAlliance)}: {ex}"); - throw; // Rethrow the exception to maintain the original exception flow + return false; } } diff --git a/RotationSolver.Basic/Helpers/StatusHelper.cs b/RotationSolver.Basic/Helpers/StatusHelper.cs index 81fe3dd6d..c0b23e6ae 100644 --- a/RotationSolver.Basic/Helpers/StatusHelper.cs +++ b/RotationSolver.Basic/Helpers/StatusHelper.cs @@ -176,11 +176,12 @@ private static IEnumerable GetAllStatus(this BattleChara obj, bool isFro try { if (obj == null) return Array.Empty(); - if (obj.StatusList == null) return Array.Empty(); + if (obj.StatusList == null || obj.StatusList.Length == 0) return Array.Empty(); - return obj.StatusList.Where(status => !isFromSelf + return obj?.StatusList?.Where(status => !isFromSelf || status.SourceId == Player.Object.ObjectId - || status.SourceObject?.OwnerId == Player.Object.ObjectId); + || status.SourceObject?.OwnerId == Player.Object.ObjectId) + ?? Array.Empty(); } catch (Exception ex) {