diff --git a/Craftimizer/Utils/SynthesisValues.cs b/Craftimizer/Utils/SynthesisValues.cs index 4d22243..494d177 100644 --- a/Craftimizer/Utils/SynthesisValues.cs +++ b/Craftimizer/Utils/SynthesisValues.cs @@ -48,6 +48,8 @@ internal sealed unsafe class SynthesisValues(AddonSynthesis* addon) private uint? TryGetUInt(int i) { + if (Addon == null) + return null; var value = Values[i]; return value.Type == ValueType.UInt ? value.UInt : @@ -56,6 +58,8 @@ internal sealed unsafe class SynthesisValues(AddonSynthesis* addon) private bool? TryGetBool(int i) { + if (Addon == null) + return null; var value = Values[i]; return value.Type == ValueType.Bool ? value.Byte != 0 : @@ -64,6 +68,8 @@ internal sealed unsafe class SynthesisValues(AddonSynthesis* addon) private SeString? TryGetString(int i) { + if (Addon == null) + return null; var value = Values[i]; return value.Type switch { diff --git a/Craftimizer/Windows/SynthHelper.cs b/Craftimizer/Windows/SynthHelper.cs index c703f6c..4060db0 100644 --- a/Craftimizer/Windows/SynthHelper.cs +++ b/Craftimizer/Windows/SynthHelper.cs @@ -528,6 +528,9 @@ public sealed unsafe class SynthHelper : Window, IDisposable private void OnUseAction(ActionType action) { + if (!ShouldOpen || IsCollapsed) + return; + (_, CurrentState) = new SimNoRandom().Execute(GetCurrentState(), action); CurrentActionCount = CurrentState.ActionCount; CurrentActionStates = CurrentState.ActionStates;