File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -386,6 +386,9 @@ int HID_API_EXPORT hid_init(void)
386386 register_global_error (NULL );
387387 if (!hid_hotplug_context .mutex ) {
388388 hid_hotplug_context .mutex = CreateMutexA (NULL , FALSE, NULL );
389+ if (!hid_hotplug_context .mutex ) {
390+ register_global_error (L"Failed to create hotplug management mutex" );
391+ }
389392 }
390393#ifndef HIDAPI_USE_DDK
391394 if (!hidapi_initialized ) {
@@ -410,9 +413,11 @@ static void hid_internal_cleanup_hotplugs()
410413 hid_hotplug_context .devs = NULL ;
411414 }
412415
413- if (CM_Unregister_Notification (hid_hotplug_context .notify_handle ) != CR_SUCCESS ) {
414- register_global_error (L"hid_hotplug_deregister_callback/CM_Unregister_Notification" );
415- return ;
416+ if (hid_hotplug_context .notify_handle ) {
417+ if (CM_Unregister_Notification (hid_hotplug_context .notify_handle ) != CR_SUCCESS ) {
418+ register_global_error (L"hid_hotplug_deregister_callback/CM_Unregister_Notification" );
419+ return ;
420+ }
416421 }
417422
418423 hid_hotplug_context .notify_handle = NULL ;
You can’t perform that action at this time.
0 commit comments