Adding status check for GetSerial() for the EVGA Keyboard to resolve #2531
* Adding status check for `hid_get_serial_number_string()` to ensure serial string is valid.
This commit is contained in:
parent
0282f761cd
commit
7900e52291
1 changed files with 7 additions and 1 deletions
|
|
@ -89,7 +89,13 @@ std::string EVGAKeyboardController::GetSerial()
|
|||
const uint8_t sz = HID_MAX_STR;
|
||||
wchar_t tmp[sz];
|
||||
|
||||
hid_get_serial_number_string(dev, tmp, sz);
|
||||
int ret = hid_get_serial_number_string(dev, tmp, sz);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
return("");
|
||||
}
|
||||
|
||||
std::wstring w_tmp = std::wstring(tmp);
|
||||
std::string serial = std::string(w_tmp.begin(), w_tmp.end());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue