mirror of
https://git.wownero.com/wownero/wownero.git
synced 2025-01-18 14:18:34 +00:00
Merge pull request #5800
6ca033d hid_error() could return a null, which causes the program to crash with (TheQuantumPhysicist)
This commit is contained in:
commit
28e0a28b96
@ -44,7 +44,8 @@ namespace hw {
|
|||||||
|
|
||||||
static std::string safe_hid_error(hid_device *hwdev) {
|
static std::string safe_hid_error(hid_device *hwdev) {
|
||||||
if (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");
|
return std::string("NULL device");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user