mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-29 19:31:08 -04:00
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:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user