1
0
Fork 0

Guard against a null result from HID code.

It seems strange that CFGetTypeID on null would crash, but the reports
from users suggest this might be the case.
This commit is contained in:
James Turner 2016-11-20 22:42:33 +00:00
parent b0d707c3f4
commit 4db129cb01

View file

@ -265,7 +265,7 @@ void FGMacOSXEventInputPrivate::removedDevice(IOHIDDeviceRef device)
std::string FGMacOSXEventInputPrivate::getDeviceStringProperty(IOHIDDeviceRef device, CFStringRef hidProp)
{
CFStringRef prop = (CFStringRef) IOHIDDeviceGetProperty(device, hidProp);
if (CFGetTypeID(prop) != CFStringGetTypeID()) {
if ((prop == nullptr)|| (CFGetTypeID(prop) != CFStringGetTypeID())) {
return std::string();
}