diff --git a/src/Input/FGMacOSXEventInput.cxx b/src/Input/FGMacOSXEventInput.cxx index 517322e17..b8d7168fe 100644 --- a/src/Input/FGMacOSXEventInput.cxx +++ b/src/Input/FGMacOSXEventInput.cxx @@ -229,9 +229,11 @@ void FGMacOSXEventInput::shutdown() { FGEventInput::shutdown(); - IOHIDManagerClose(d->hidManager, kIOHIDOptionsTypeNone); - IOHIDManagerUnscheduleFromRunLoop(d->hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); - CFRelease(d->hidManager); + if (d->hidManager) { + IOHIDManagerClose(d->hidManager, kIOHIDOptionsTypeNone); + IOHIDManagerUnscheduleFromRunLoop(d->hidManager, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + CFRelease(d->hidManager); + } } //