diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2019-08-21 15:36:05 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2019-08-21 15:36:05 -0500 |
| commit | 28e0a28b96212abce237e7b94df78bd4541a66c1 (patch) | |
| tree | 50f38cec06028b66faa6244a9b003e5a0397e077 /src | |
| parent | d035af8e92e34146072d8b9b1384d3d3889a7481 (diff) | |
| parent | 6ca033d2784cbdf886b54d4acc4b8f6e1417cd22 (diff) | |
| download | monzero-core-28e0a28b96212abce237e7b94df78bd4541a66c1.tar.gz monzero-core-28e0a28b96212abce237e7b94df78bd4541a66c1.tar.xz monzero-core-28e0a28b96212abce237e7b94df78bd4541a66c1.zip | |
Merge pull request #5800
6ca033d hid_error() could return a null, which causes the program to crash with (TheQuantumPhysicist)
Diffstat (limited to 'src')
| -rw-r--r-- | src/device/device_io_hid.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/device/device_io_hid.cpp b/src/device/device_io_hid.cpp index 721bed9ca..72f4c3bdb 100644 --- a/src/device/device_io_hid.cpp +++ b/src/device/device_io_hid.cpp @@ -44,7 +44,8 @@ namespace hw { static std::string safe_hid_error(hid_device *hwdev) { if (hwdev) { - return std::string((char*)hid_error(hwdev)); + const char* error_str = (const char*)hid_error(hwdev); + return std::string(error_str == nullptr ? "Unknown error" : error_str); } return std::string("NULL device"); } |
