aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-14 21:21:52 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-14 21:21:52 +0300
commit3fa8b8e1866933fdfccd0598a11e443fc1693840 (patch)
tree46d8d9eb19beca0e8c4256ab7efb1edbafec09cf /ext/bg
parenta02cf28c5775bdd72f209b46e9974768e5c5db71 (diff)
prevent infinite loop if source length is 0
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/backend.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index d5086af2..960c65bf 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -324,7 +324,7 @@ class Backend {
{},
options
);
- if (definitions.length > 0) {
+ if (definitions.length > 0 && sourceLength > 0) {
dictTermsSort(definitions);
const {expression, reading} = definitions[0];
const source = text.substring(0, sourceLength);