From 95efd9fbbc77da9bbe9571abd65d149cef94b7c2 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:16:44 +0200 Subject: [PATCH] Add IsLoaded check to PawnIo.Close() method to prevent closing invalid handles (#1916) * Initial plan * Add IsLoaded check to PawnIo.Close() method to prevent closing invalid handles Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> --- LibreHardwareMonitorLib/PawnIo/PawnIo.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LibreHardwareMonitorLib/PawnIo/PawnIo.cs b/LibreHardwareMonitorLib/PawnIo/PawnIo.cs index 7fddbc0..d993baa 100644 --- a/LibreHardwareMonitorLib/PawnIo/PawnIo.cs +++ b/LibreHardwareMonitorLib/PawnIo/PawnIo.cs @@ -68,7 +68,11 @@ public class PawnIo return new PawnIo(null); } - public void Close() => _handle.Close(); + public void Close() + { + if (IsLoaded) + _handle.Close(); + } public long[] Execute(string name, long[] input, int outLength) {