Avoid a crash on HID devices with no name.
This commit is contained in:
parent
5f2f72a4eb
commit
955138d06e
1 changed files with 4 additions and 2 deletions
|
@ -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) + " " +
|
||||||
|
|
Loading…
Reference in a new issue