From a51f794c6132a65fb6fbb5e81881231bf959f6c7 Mon Sep 17 00:00:00 2001 From: d-faure Date: Sat, 11 Jul 2020 13:26:43 +0200 Subject: [PATCH] Minimal hint to prevent potential NRE This is a source code only direct modification. Please provide a 1.10 recompilation --- ModPanelComponent.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ModPanelComponent.cs b/ModPanelComponent.cs index 273e66d..7238832 100644 --- a/ModPanelComponent.cs +++ b/ModPanelComponent.cs @@ -142,7 +142,7 @@ public void Update () { // try any non-null callback in order var func = new Callback[] { button.onTrue, button.onHover, button.onLeftClick, button.onEnable, button.onFalse, button.onHoverOut, button.onDisable } - .Select(cb => cb.GetInvocationList().Skip(1).FirstOrDefault()).Where(m => m != null).FirstOrDefault(); var method = func.Method.Name; + .Select(cb => cb.GetInvocationList().Skip(1).FirstOrDefault()).Where(m => m != null).FirstOrDefault(); // button with no callbacks. Ignore. if (func == null) @@ -152,6 +152,7 @@ public void Update () { if (module.EndsWith (".dll")) module = module.Substring (0, module.Length - 4); + var method = func.Method.Name; if (AdjustableModPanel.Instance.IsButtonToolbarController (button, out string name, out string id)) { // button created by ToolbarControl needs special treatment module = name;