aboutsummaryrefslogtreecommitdiff
path: root/javascript/edit-attention.js
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-12 09:07:49 +0300
committerGitHub <noreply@github.com>2022-10-12 09:07:49 +0300
commitc15c3b08df7690670f15f5f5a86ca20b6918cd41 (patch)
treeb89622819db4f794f8c03632a6b5936131436428 /javascript/edit-attention.js
parentfd07b103aeb70a80e3641068e483475e32c9750c (diff)
parent6d408c06c634cc96480f055941754dcc43f781d9 (diff)
Merge pull request #2312 from AUTOMATIC1111/edit-attention-nan-fix
edit attention key handler: return early when weight parse returns NaN
Diffstat (limited to 'javascript/edit-attention.js')
-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;