From e914f339906b8656211d7efd4da678e416e93d35 Mon Sep 17 00:00:00 2001 From: MidoriKami <9083275+MidoriKami@users.noreply.github.com> Date: Fri, 8 Sep 2023 01:20:29 -0700 Subject: [PATCH] Remove redundant null checking, and unused module log. There's no reasonable way the args passed in will be null. There's tons of null checking that square does before passing the pointers to these functions. If they are null, then the game has likely already crashed. --- Dalamud/Game/AddonLifecycle/AddonLifecycle.cs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Dalamud/Game/AddonLifecycle/AddonLifecycle.cs b/Dalamud/Game/AddonLifecycle/AddonLifecycle.cs index 321c60a15..014033312 100644 --- a/Dalamud/Game/AddonLifecycle/AddonLifecycle.cs +++ b/Dalamud/Game/AddonLifecycle/AddonLifecycle.cs @@ -138,9 +138,6 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType private nint OnAddonSetup(AtkUnitBase* addon) { - if (addon is null) - return this.onAddonSetupHook.Original(addon); - try { this.InvokeListeners(AddonEvent.PreSetup, new IAddonLifecycle.AddonArgs { Addon = (nint)addon }); @@ -166,12 +163,6 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType private void OnAddonFinalize(AtkUnitManager* unitManager, AtkUnitBase** atkUnitBase) { - if (atkUnitBase is null || atkUnitBase[0] is null) - { - this.onAddonFinalizeHook.Original(unitManager, atkUnitBase); - return; - } - try { this.InvokeListeners(AddonEvent.PreFinalize, new IAddonLifecycle.AddonArgs { Addon = (nint)atkUnitBase[0] }); @@ -288,8 +279,6 @@ internal unsafe class AddonLifecycle : IDisposable, IServiceType #pragma warning restore SA1015 internal class AddonLifecyclePluginScoped : IDisposable, IServiceType, IAddonLifecycle { - private static readonly ModuleLog Log = new("AddonLifecycle:PluginScoped"); - [ServiceManager.ServiceDependency] private readonly AddonLifecycle addonLifecycleService = Service.Get();