mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-21 09:23:00 +00:00
feat: enable stricter type checking options
feat: make the app more fault tolerant
This commit is contained in:
@@ -23,9 +23,9 @@ export function compressActions(actions: number[]): Uint8Array {
|
||||
export function decompressActions(raw: Uint8Array): number[] {
|
||||
const actions: number[] = [];
|
||||
for (let i = 0; i < raw.length; i++) {
|
||||
let action = raw[i];
|
||||
if (action > 0 && action < 32) {
|
||||
action = (action << 8) | raw[++i];
|
||||
let action = raw[i]!;
|
||||
if (action > 0 && action < 32 && i + 1 < raw.length) {
|
||||
action = (action << 8) | raw[++i]!;
|
||||
}
|
||||
actions.push(action);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user