From 7d480b9e2cc064cb17b312a1439df968c10e19df Mon Sep 17 00:00:00 2001 From: defnotken Date: Tue, 14 Oct 2025 10:33:44 -0500 Subject: [PATCH] Defensive handling and NRE removal. --- LightlessSync/Services/NameplateHandler.cs | 8 +++++++- LightlessSync/UI/SyncshellFinderUI.cs | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LightlessSync/Services/NameplateHandler.cs b/LightlessSync/Services/NameplateHandler.cs index dc761bb..a28be5f 100644 --- a/LightlessSync/Services/NameplateHandler.cs +++ b/LightlessSync/Services/NameplateHandler.cs @@ -208,7 +208,13 @@ public unsafe class NameplateHandler : IMediatorSubscriber for (int i = 0; i < ui3DModule->NamePlateObjectInfoCount; ++i) { - var objectInfo = ui3DModule->NamePlateObjectInfoPointers[i].Value; + if (ui3DModule->NamePlateObjectInfoPointers.IsEmpty) continue; + + var objectInfoPtr = ui3DModule->NamePlateObjectInfoPointers[i]; + + if (objectInfoPtr == null) continue; + + var objectInfo = objectInfoPtr.Value; if (objectInfo == null || objectInfo->GameObject == null) continue; diff --git a/LightlessSync/UI/SyncshellFinderUI.cs b/LightlessSync/UI/SyncshellFinderUI.cs index 971d40c..46b7bfa 100644 --- a/LightlessSync/UI/SyncshellFinderUI.cs +++ b/LightlessSync/UI/SyncshellFinderUI.cs @@ -288,8 +288,6 @@ public class SyncshellFinderUI : WindowMediatorSubscriberBase return; } - var currentGids = _nearbySyncshells.Select(s => s.Group.GID).ToHashSet(StringComparer.Ordinal); - if (updatedList != null) { var previousGid = GetSelectedGid();