prevent infinite loop if source length is 0

This commit is contained in:
siikamiika 2020-04-14 21:21:52 +03:00
parent a02cf28c57
commit 3fa8b8e186

View File

@ -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);