From ab23705cdb81084cf84b60cdd43d6b682371c705 Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Sat, 22 Jun 2024 03:31:31 -0700 Subject: [PATCH] debug tweak; extra null check on EventSystem.current --- MultiSelectDebug.cs | 6 ++---- Patches/ContextMenuShortcutPatches.cs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/MultiSelectDebug.cs b/MultiSelectDebug.cs index aed68ea..ba5ca55 100644 --- a/MultiSelectDebug.cs +++ b/MultiSelectDebug.cs @@ -36,8 +36,7 @@ namespace UIFixes foreach (ItemContextClass itemContext in MultiSelect.ItemContexts) { - builder.AppendFormat("x{0} {1}", itemContext.Item.StackObjectsCount, itemContext.Item.ToString()); - builder.AppendLine(); + builder.AppendFormat("x{0} {1}\n", itemContext.Item.StackObjectsCount, itemContext.Item.ToString()); } if (MultiSelect.SecondaryContexts.Any()) @@ -45,8 +44,7 @@ namespace UIFixes builder.AppendFormat("Secondary Items: {0}\n", MultiSelect.SecondaryCount); foreach (ItemContextClass itemContext in MultiSelect.SecondaryContexts) { - builder.Append(itemContext.Item.ToString()); - builder.AppendLine(); + builder.AppendFormat("x{0} {1}\n", itemContext.Item.StackObjectsCount, itemContext.Item.ToString()); } } diff --git a/Patches/ContextMenuShortcutPatches.cs b/Patches/ContextMenuShortcutPatches.cs index a54f31e..cbd19e5 100644 --- a/Patches/ContextMenuShortcutPatches.cs +++ b/Patches/ContextMenuShortcutPatches.cs @@ -29,7 +29,7 @@ namespace UIFixes { // Need an item context to operate on, and ignore these keypresses if there's a focused textbox somewhere ItemContextAbstractClass itemContext = __instance.R().ItemContext; - if (itemContext == null || EventSystem.current.currentSelectedGameObject?.GetComponent() != null) + if (itemContext == null || EventSystem.current?.currentSelectedGameObject?.GetComponent() != null) { return; }