mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-10-20 07:35:03 -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:
1 parent
0282f761cd
commit
7900e52291
1 file changed
+7
-1
@@ -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