Skip to content

Disconnecting right after a round finishes leaves round victor unknown #62

@mat1jaczyyy

Description

@mat1jaczyyy

If a player wins a round and then immediately disconnects before the room.game.on("score", event can fire, then victor will be undefined.

/srv/eucannon-test/bot/index.js:453
                .input('winner', room.tournament_match.players.indexOf(victor.user.id) + 1)
                                                                              ^

TypeError: Cannot read properties of undefined (reading 'user')
    at Game.<anonymous> (/srv/eucannon-test/bot/index.js:453:79)
    at Game.emit (node:events:518:28)
    at /srv/eucannon-test/bot/node_modules/tetr.js/dist/ws/commands/game.end.js:60:29
    at Generator.next (<anonymous>)
    at /srv/eucannon-test/bot/node_modules/tetr.js/dist/ws/commands/game.end.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/srv/eucannon-test/bot/node_modules/tetr.js/dist/ws/commands/game.end.js:4:12)
    at default_1 (/srv/eucannon-test/bot/node_modules/tetr.js/dist/ws/commands/game.end.js:14:12)
    at WebSocketManager.<anonymous> (/srv/eucannon-test/bot/node_modules/tetr.js/dist/ws/WebSocketManager.js:187:23)
    at Generator.next (<anonymous>)

In EU Cannon code:

https://github.com/EUCannon/bot/blob/94b0a303cb1f6771537fba8d711d16a07a6913de/index.js#L447-L454

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions