Skip to content

Commit

Permalink
Fix crash (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
DallasHoff committed Jan 5, 2024
1 parent 9922813 commit c1674c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files.eol": "\n",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.rulers": [ 140 ],
"eslint.enable": true
Expand Down
8 changes: 6 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ import { Color, OpenRgbColor, RgbDevice, RgbDeviceStates } from './rgb';

/** Gets the RGB color that is set on the provided device */
export function getDeviceLedRgbColor(device: RgbDevice): Color {
const ledColor: OpenRgbColor = device.colors[0];
const ledRgb: Color = [ledColor.red, ledColor.green, ledColor.blue];
const ledColor: OpenRgbColor = device?.colors?.[0];
const ledRgb: Color = [
ledColor?.red ?? 0,
ledColor?.green ?? 0,
ledColor?.blue ?? 0,
];
return ledRgb;
}

Expand Down

0 comments on commit c1674c7

Please sign in to comment.