From 955138d06e11a0ff52b95bc020c431bce288c1dc Mon Sep 17 00:00:00 2001 From: James Turner <zakalawe@mac.com> Date: Thu, 16 May 2019 11:11:19 +0200 Subject: [PATCH] Avoid a crash on HID devices with no name. --- src/Input/FGHIDEventInput.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Input/FGHIDEventInput.cxx b/src/Input/FGHIDEventInput.cxx index 447229e26..7261fc5b3 100644 --- a/src/Input/FGHIDEventInput.cxx +++ b/src/Input/FGHIDEventInput.cxx @@ -342,8 +342,10 @@ FGHIDDevice::FGHIDDevice(hid_device_info *devInfo, FGHIDEventInput *) { _hidPath = devInfo->path; - std::wstring manufacturerName, - productName = std::wstring(devInfo->product_string); + std::wstring manufacturerName, productName; + productName = devInfo->product_string ? std::wstring(devInfo->product_string) + : L"unknown HID device"; + if (devInfo->manufacturer_string) { manufacturerName = std::wstring(devInfo->manufacturer_string); SetName(simgear::strutils::convertWStringToUtf8(manufacturerName) + " " +