From 3fa8b8e1866933fdfccd0598a11e443fc1693840 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Tue, 14 Apr 2020 21:21:52 +0300 Subject: [PATCH] prevent infinite loop if source length is 0 --- ext/bg/js/backend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);