From c07023de377709d69fc02a150bcf8213816e1885 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Sun, 24 Mar 2019 11:36:42 -0300 Subject: [PATCH] prevent crash when handshake is null (no state schema) --- package.json | 2 +- src/Room.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c3ece64..c2d768d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colyseus.js", - "version": "0.10.1", + "version": "0.10.2", "description": "Multiplayer Game Client for the Browser", "keywords": [ "colyseus", diff --git a/src/Room.ts b/src/Room.ts index f8e1d3f..96a4140 100644 --- a/src/Room.ts +++ b/src/Room.ts @@ -141,7 +141,7 @@ export class Room { this.serializer = new serializer(); } - if (this.serializer.handshake) { + if (view.buffer.byteLength > offset && this.serializer.handshake) { const bytes = Array.from(new Uint8Array(view.buffer.slice(offset))); this.serializer.handshake(bytes); }