Skip to content

Commit

Permalink
refactor: destructure ref from slpFile
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Nov 3, 2022
1 parent f2e04cb commit 15a8620
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/slpReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export function getMetadata(slpFile: SlpFileType): MetadataType | null {
}

export function getGameEnd(slpFile: SlpFileType): GameEndType | null {
const { rawDataPosition, rawDataLength, messageSizes } = slpFile;
const { ref, rawDataPosition, rawDataLength, messageSizes } = slpFile;
const gameEndPayloadSize = messageSizes[Command.GAME_END];
if (!exists(gameEndPayloadSize) || gameEndPayloadSize <= 0) {
return null;
Expand All @@ -657,7 +657,7 @@ export function getGameEnd(slpFile: SlpFileType): GameEndType | null {
const gameEndPosition = rawDataPosition + rawDataLength - gameEndSize;

const buffer = new Uint8Array(gameEndSize);
readRef(slpFile.ref, buffer, 0, buffer.length, gameEndPosition);
readRef(ref, buffer, 0, buffer.length, gameEndPosition);
if (buffer[0] !== Command.GAME_END) {
// This isn't even a game end payload
return null;
Expand Down

0 comments on commit 15a8620

Please sign in to comment.