aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorTheQuantumPhysicist <info@afach.de>2019-08-09 21:24:48 +0200
committerTheQuantumPhysicist <info@afach.de>2019-08-09 21:24:48 +0200
commit6ca033d2784cbdf886b54d4acc4b8f6e1417cd22 (patch)
treed0b330e8ab6f001eccf98b9e479b04aed1f2604a /src/device
parentMerge pull request #5635 (diff)
downloadmonero-6ca033d2784cbdf886b54d4acc4b8f6e1417cd22.tar.xz
hid_error() could return a null, which causes the program to crash with
std::logic_error()
Diffstat (limited to 'src/device')
-rw-r--r--src/device/device_io_hid.cpp3
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");
}