Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit f3f7f49

Browse files
Add sanity-check to CueSDK.EnableKeypressHandler() to ensure handlers are only enabled once. Resolves #69.
1 parent 3b46496 commit f3f7f49

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CueSDK.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ public static void EnableKeypressCallback()
269269
if (!IsInitialized)
270270
throw new WrapperException("CueSDK isn't initialized.");
271271

272+
if (_onKeyPressedDelegate != null)
273+
return;
274+
272275
_onKeyPressedDelegate = OnKeyPressed;
273276
_CUESDK.CorsairRegisterKeypressCallback(Marshal.GetFunctionPointerForDelegate(_onKeyPressedDelegate), IntPtr.Zero);
274277
}

0 commit comments

Comments
 (0)