Skip to content

Commit 3dc1948

Browse files
xxCherryKotRikD
authored andcommitted
fix: check if statistics dict is not null
1 parent e5df17b commit 3dc1948

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"@typescript-eslint/no-unused-vars": ["error", {
1515
"vars": "all",
1616
"args": "after-used",
17-
"ignoreRestSiblings": true
17+
"ignoreRestSiblings": true,
18+
"argsIgnorePattern": "^_"
1819
}],
1920
"prefer-const": ["error", {
2021
"destructuring": "all"

packages/tosu/src/memory/lazer.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
417417
}
418418

419419
private readStatisticsDict(statisticsDict: number) {
420-
const statisticsCount = this.process.readInt(statisticsDict + 0x38);
421-
422420
const statistics: Statistics = {
423421
miss: 0,
424422
meh: 0,
@@ -439,6 +437,12 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
439437
legacyComboIncrease: 0
440438
};
441439

440+
if (!statisticsDict) {
441+
return statistics;
442+
}
443+
444+
const statisticsCount = this.process.readInt(statisticsDict + 0x38);
445+
442446
const statisticsEntries = this.process.readIntPtr(
443447
statisticsDict + 0x10
444448
);
@@ -813,23 +817,23 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
813817
throw new Error('Lazer:settingsPointers not implemented.');
814818
}
815819

816-
configOffsets(address: number, list: ConfigList): IOffsets {
820+
configOffsets(_address: number, _list: ConfigList): IOffsets {
817821
throw new Error('Lazer:configOffsets not implemented.');
818822
}
819823

820-
bindingsOffsets(address: number, list: BindingsList): IOffsets {
824+
bindingsOffsets(_address: number, _list: BindingsList): IOffsets {
821825
throw new Error('Lazer:bindingsOffsets not implemented.');
822826
}
823827

824828
configValue(
825-
address: number,
826-
position: number,
827-
list: ConfigList
829+
_address: number,
830+
_position: number,
831+
_list: ConfigList
828832
): IConfigValue {
829833
throw new Error('Lazer:configValue not implemented.');
830834
}
831835

832-
bindingValue(address: number, position: number): IBindingValue {
836+
bindingValue(_address: number, _position: number): IBindingValue {
833837
throw new Error('Lazer:bindingValue not implemented.');
834838
}
835839

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

1862-
tourneyChat(messages: ITourneyManagerChatItem[]): ITourneyChat {
1866+
tourneyChat(_messages: ITourneyManagerChatItem[]): ITourneyChat {
18631867
throw new Error('Lazer:tourneyChat not implemented.');
18641868
}
18651869

0 commit comments

Comments
 (0)