From b2fafec5fc9febaac9bc37e408a99695e4003044 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 7 Mar 2021 21:41:36 +0100 Subject: [PATCH] handle key-normalization errors --- copyparty/web/browser.js | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 902ec30f..25f55209 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -1289,16 +1289,33 @@ var mukey = (function () { if (min) for (var a = 0, aa = rows.length; a < aa; a++) { - var v = rows[a].cells[i].getAttribute('html'); - rows[a].cells[i].setAttribute('html', map[v] || v); + var c = rows[a].cells[i]; + if (!c) + continue; + + var v = c.getAttribute('html'); + c.setAttribute('html', map[v] || v); } else for (var a = 0, aa = rows.length; a < aa; a++) { - var v = rows[a].cells[i].textContent; - rows[a].cells[i].textContent = map[v] || v; + var c = rows[a].cells[i]; + if (!c) + continue; + + var v = c.textContent; + c.textContent = map[v] || v; } } + function try_render() { + try { + render(); + } + catch (ex) { + console.log("key notation failed: " + ex); + } + } + var notation = sread("key_notation") || "rekobo_alnum"; ebi('key_' + notation).checked = true; load_notation(notation); @@ -1309,7 +1326,7 @@ var mukey = (function () { } return { - "render": render + "render": try_render }; })();