When bancho.js joins an existing lobby, you can receive playerMoved or
playerLeft events before bancho.js had the time to fetch the lobby
info. When that happens, an unhandled error is thrown, since "undefined"
is not a valid key for the slots array.
I chose to just check if getPlayerSlot() returns something, but a better
fix might be to ignore those events until the lobby is initialized.
Original errors (as logged by sentry):
TypeError: Cannot add property undefined, object is not extensible
File "/root/osubot/node_modules/bancho.js/lib/Multiplayer/BanchoLobby.js", line 224, col 28, in null.<anonymous>
this.slots[oldSlot] = null;
File "node:internal/process/task_queues", line 96, col 5, in processTicksAndRejections
TypeError: Cannot add property undefined, object is not extensible
File "/root/osubot/node_modules/bancho.js/lib/Multiplayer/BanchoLobby.js", line 242, col 25, in null.<anonymous>
this.slots[slot] = null;
File "node:internal/process/task_queues", line 96, col 5, in processTicksAndRejections
Eh, it has never been ignoring the events, and I don't see much stuff that can go wrong with pre-!mp settings events really. It's probably fine to handle these as you have.
When bancho.js joins an existing lobby, you can receive playerMoved or playerLeft events before bancho.js had the time to fetch the lobby info. When that happens, an unhandled error is thrown, since "undefined" is not a valid key for the slots array.
I chose to just check if getPlayerSlot() returns something, but a better fix might be to ignore those events until the lobby is initialized.
Original errors (as logged by sentry):