]> git.sesse.net Git - remoteglot/commitdiff
Fix the PV check.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 14 Nov 2016 18:52:08 +0000 (19:52 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 14 Nov 2016 18:52:28 +0000 (19:52 +0100)
www/js/remoteglot.js

index 5674cf19f996de47caea89ab07547c898a8aff22..05ae295b19151acbf063174aec2d969c5f2adc15 100644 (file)
@@ -279,11 +279,13 @@ var request_update = function() {
 
                // Verify that the PV makes sense.
                var valid = true;
 
                // Verify that the PV makes sense.
                var valid = true;
-               var hiddenboard = new Chess(new_data['position']['fen']);
-               for (var i = 0; i < new_data['pv'].length; ++i) {
-                       if (hiddenboard.move(data['pv'][i]) === null) {
-                               valid = false;
-                               break;
+               if (new_data['pv']) {
+                       var hiddenboard = new Chess(new_data['position']['fen']);
+                       for (var i = 0; i < new_data['pv'].length; ++i) {
+                               if (hiddenboard.move(new_data['pv'][i]) === null) {
+                                       valid = false;
+                                       break;
+                               }
                        }
                }
 
                        }
                }