From d401a50e0a13710561e3fa2129c53da0a9b6c4aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Aceda=C5=84ski?= Date: Sat, 25 Feb 2017 14:42:40 +0100 Subject: [PATCH] Fix crash on Mac OS X when FG does not finish input init --- src/Input/FGMacOSXEventInput.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); + } } //