Skip to content

Commit

Permalink
fix: check if statistics dict is not null
Browse files Browse the repository at this point in the history
  • Loading branch information
xxCherry authored and KotRikD committed Nov 12, 2024
1 parent e5df17b commit 3dc1948
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"@typescript-eslint/no-unused-vars": ["error", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true
"ignoreRestSiblings": true,
"argsIgnorePattern": "^_"
}],
"prefer-const": ["error", {
"destructuring": "all"
Expand Down
22 changes: 13 additions & 9 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
}

private readStatisticsDict(statisticsDict: number) {
const statisticsCount = this.process.readInt(statisticsDict + 0x38);

const statistics: Statistics = {
miss: 0,
meh: 0,
Expand All @@ -439,6 +437,12 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
legacyComboIncrease: 0
};

if (!statisticsDict) {
return statistics;
}

const statisticsCount = this.process.readInt(statisticsDict + 0x38);

const statisticsEntries = this.process.readIntPtr(
statisticsDict + 0x10
);
Expand Down Expand Up @@ -813,23 +817,23 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
throw new Error('Lazer:settingsPointers not implemented.');
}

configOffsets(address: number, list: ConfigList): IOffsets {
configOffsets(_address: number, _list: ConfigList): IOffsets {
throw new Error('Lazer:configOffsets not implemented.');
}

bindingsOffsets(address: number, list: BindingsList): IOffsets {
bindingsOffsets(_address: number, _list: BindingsList): IOffsets {
throw new Error('Lazer:bindingsOffsets not implemented.');
}

configValue(
address: number,
position: number,
list: ConfigList
_address: number,
_position: number,
_list: ConfigList
): IConfigValue {
throw new Error('Lazer:configValue not implemented.');
}

bindingValue(address: number, position: number): IBindingValue {
bindingValue(_address: number, _position: number): IBindingValue {
throw new Error('Lazer:bindingValue not implemented.');
}

Expand Down Expand Up @@ -1859,7 +1863,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
throw new Error('Lazer:tourney not implemented.');
}

tourneyChat(messages: ITourneyManagerChatItem[]): ITourneyChat {
tourneyChat(_messages: ITourneyManagerChatItem[]): ITourneyChat {
throw new Error('Lazer:tourneyChat not implemented.');
}

Expand Down

0 comments on commit 3dc1948

Please sign in to comment.