]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Deal with negative depths.
[remoteglot] / www / js / remoteglot.js
index 04bc1493c9f37a51bf39d05208181b1bb000b7c4..7ad1ff02565d904c2080e662a1ad7731b5a5f3e7 100644 (file)
@@ -822,7 +822,11 @@ var update_refutation_lines = function() {
                var depth_td = document.createElement("td");
                tr.appendChild(depth_td);
                $(depth_td).addClass("depth");
-               $(depth_td).text("d" + line['depth']);
+               if (line['depth'] && line['depth'] >= 0) {
+                       $(depth_td).text("d" + line['depth']);
+               } else {
+                       $(depth_td).text("—");
+               }
 
                var pv_td = document.createElement("td");
                tr.appendChild(pv_td);
@@ -1907,6 +1911,9 @@ var fmt_cp = function(v) {
 }
 
 var format_short_score = function(score) {
+       if (!score) {
+               return "???";
+       }
        if (score[0] === 'm') {
                if (score[2]) {  // Is a bound.
                        return score[2] + "\u00a0M" + pad(score[1], 3);