aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDepFA <35278260+dfaker@users.noreply.github.com>2022-10-12 00:19:28 +0100
committerGitHub <noreply@github.com>2022-10-12 00:19:28 +0100
commit6d408c06c634cc96480f055941754dcc43f781d9 (patch)
tree529680b936562e6df08c07e2af3622b9b011a739
parent6be32b31d181e42c639dad3451229aa7b9cfd1cf (diff)
Prevent nans from failed float parsing from overwriting weights
-rw-r--r--javascript/edit-attention.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/javascript/edit-attention.js b/javascript/edit-attention.js
index 79566a2e..3f1d2fbb 100644
--- a/javascript/edit-attention.js
+++ b/javascript/edit-attention.js
@@ -25,6 +25,7 @@ addEventListener('keydown', (event) => {
} else {
end = target.value.slice(selectionEnd + 1).indexOf(")") + 1;
weight = parseFloat(target.value.slice(selectionEnd + 1, selectionEnd + 1 + end));
+ if (isNaN(weight)) return;
if (event.key == minus) weight -= 0.1;
if (event.key == plus) weight += 0.1;