1
0
Fork 0

Avoid a crash on HID devices with no name.

This commit is contained in:
James Turner 2019-05-16 11:11:19 +02:00
parent 5f2f72a4eb
commit 955138d06e

View file

@ -342,8 +342,10 @@ FGHIDDevice::FGHIDDevice(hid_device_info *devInfo, FGHIDEventInput *)
{ {
_hidPath = devInfo->path; _hidPath = devInfo->path;
std::wstring manufacturerName, std::wstring manufacturerName, productName;
productName = std::wstring(devInfo->product_string); productName = devInfo->product_string ? std::wstring(devInfo->product_string)
: L"unknown HID device";
if (devInfo->manufacturer_string) { if (devInfo->manufacturer_string) {
manufacturerName = std::wstring(devInfo->manufacturer_string); manufacturerName = std::wstring(devInfo->manufacturer_string);
SetName(simgear::strutils::convertWStringToUtf8(manufacturerName) + " " + SetName(simgear::strutils::convertWStringToUtf8(manufacturerName) + " " +