X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=20d0f47092352212b2696dae7b341bcac897dc03;hb=0cb758e078f4981d1e5b5209e66ca02f544ec9d5;hp=1338132324f1c51746a340835b482fb67c96e45f;hpb=3066bb47f49d374fca4c1c1cc047d9be8257ad35;p=vchess.git diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index 13381323..20d0f470 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -526,7 +526,11 @@ Vue.component('my-game', { { if (!this.oppConnected) return; //abort move if opponent is gone - this.conn.send(JSON.stringify({code:"newmove", move:move, oppid:this.oppid})); + try { + this.conn.send(JSON.stringify({code:"newmove", move:move, oppid:this.oppid})); + } catch(INVALID_STATE_ERR) { + return; //abort also if we lost connection + } } new Audio("/sounds/chessmove1.mp3").play(); this.vr.play(move, "ingame");