Skips Razer device loading if invalid data is received.

This probably happens due to a general issue with OpenRazer windows
driver.

The "fix" here, simply skips loading the driver if it identifies the
device information fetched doesn't make sense -- instead of employing
NULL references at run time.

The proper fix for this issue seems to be completely remove this razer
support and move to the new RazerController approach being developed in
razer_controller branch.

Related issue: #1047.
This commit is contained in:
Fabrício Zimmerer Murta
2021-01-28 22:08:04 -03:00
committed by Adam Honse
parent 6969542e2d
commit 776f512d11

View File

@@ -142,6 +142,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_kbd_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
@@ -164,6 +166,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_mouse_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
@@ -186,6 +190,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_mousemat_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
@@ -208,6 +214,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_accessory_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
@@ -230,6 +238,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_kraken_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);
@@ -252,6 +262,8 @@ void DetectOpenRazerControllers(std::vector<RGBController*> &rgb_controllers)
num = init_razer_core_driver(&hdev);
for (unsigned int i = 0; i < num; i++)
{
if (hdev[i].dev.attr_count < 1) continue;
device_fn_type* device_fn = new device_fn_type;
load_device_fn(device_fn, &hdev[i].dev);