Better fix to remove corrupted games vs computer
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 14 Jan 2021 21:06:18 +0000 (22:06 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 14 Jan 2021 21:06:18 +0000 (22:06 +0100)
client/src/components/ComputerGame.vue
client/src/views/Rules.vue

index 72e4f5e..9cd5f9b 100644 (file)
@@ -61,7 +61,7 @@ export default {
   methods: {
     launchGame: function(game) {
       this.compWorker.postMessage(["scripts", this.gameInfo.vname]);
   methods: {
     launchGame: function(game) {
       this.compWorker.postMessage(["scripts", this.gameInfo.vname]);
-      if (!game || !V.IsGoodFen(game.fen)) {
+      if (!game) {
         game = {
           vname: this.gameInfo.vname,
           fenStart: V.GenRandInitFen(this.st.settings.randomness),
         game = {
           vname: this.gameInfo.vname,
           fenStart: V.GenRandInitFen(this.st.settings.randomness),
index dc96ffb..c069eb2 100644 (file)
@@ -120,7 +120,12 @@ export default {
       this.gameInfo.mode = mode;
       if (this.gameInfo.mode == "versus") {
         CompgameStorage.get(this.gameInfo.vname, (game) => {
       this.gameInfo.mode = mode;
       if (this.gameInfo.mode == "versus") {
         CompgameStorage.get(this.gameInfo.vname, (game) => {
-          // NOTE: game might be null
+          // NOTE: game might be null (if none stored yet)
+          if (!!game && !V.IsGoodFen(game.fen)) {
+            // Some issues with stored game: delete
+            CompgameStorage.remove(game.vname);
+            game = null;
+          }
           this.$refs["compgame"].launchGame(game);
         });
       }
           this.$refs["compgame"].launchGame(game);
         });
       }