mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 21:57:46 +00:00
hid_error() could return a null, which causes the program to crash with
std::logic_error()
This commit is contained in:
parent
8adde33e01
commit
6ca033d278
1 changed files with 2 additions and 1 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue