Fix crash related to Razer Naga Trinity

Not all devices have static_mode at position 1, just setting it without
checking can crash the app
master
Roger Roger 6 years ago committed by Adam Honse
parent 43c13db970
commit 1ee3a7c3e2

@ -464,12 +464,18 @@ void RGBController_OpenRazer::SetCustomMode()
active_mode = 0;
}
/*---------------------------------------------------------*\
| If not, use static mode. Static mode should be mode index|
| 1 because Off will be index 0 |
| If not, use static mode. |
\*---------------------------------------------------------*/
else
{
active_mode = 1;
for(int i = 0; i < modes.size(); i++)
{
if(modes[i].value == RAZER_MODE_STATIC)
{
active_mode = i;
break;
}
}
}
}

@ -412,12 +412,18 @@ void RGBController_OpenRazer::SetCustomMode()
active_mode = 0;
}
/*---------------------------------------------------------*\
| If not, use static mode. Static mode should be mode index|
| 1 because Off will be index 0 |
| If not, use static mode. |
\*---------------------------------------------------------*/
else
{
active_mode = 1;
for(int i = 0; i < modes.size(); i++)
{
if(modes[i].value == RAZER_MODE_STATIC)
{
active_mode = i;
break;
}
}
}
}

Loading…
Cancel
Save