From f3f7f498af3dc1b590384f14b5793c8487b03dec Mon Sep 17 00:00:00 2001 From: hmmwhatsthisdo Date: Sun, 22 Apr 2018 06:17:58 -0700 Subject: [PATCH] Add sanity-check to CueSDK.EnableKeypressHandler() to ensure handlers are only enabled once. Resolves #69. --- CueSDK.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CueSDK.cs b/CueSDK.cs index d783db0..383d9c9 100644 --- a/CueSDK.cs +++ b/CueSDK.cs @@ -269,6 +269,9 @@ namespace CUE.NET if (!IsInitialized) throw new WrapperException("CueSDK isn't initialized."); + if (_onKeyPressedDelegate != null) + return; + _onKeyPressedDelegate = OnKeyPressed; _CUESDK.CorsairRegisterKeypressCallback(Marshal.GetFunctionPointerForDelegate(_onKeyPressedDelegate), IntPtr.Zero); }