fix reading error of length property on null

This commit is contained in:
Giusy Digital 2024-07-17 11:25:23 +02:00 committed by GitHub
parent e2cf6adde5
commit dad98e2b51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,8 +102,13 @@ class SubsequenceProvider {
'(){}[] :;,$@%',
this.maxResultsPerBuffer
).then(matches => {
for (let k = 0; k < matches.length; k++) {
matches[k].configSuggestion = suggestions[matches[k].positions[0].row]
// The findWordsWithSubsequence method will return `null`
// if the async work was cancelled due to the buffer being
// mutated since it was enqueued.
if (matches) {
for (let k = 0; k < matches.length; k++) {
matches[k].configSuggestion = suggestions[matches[k].positions[0].row]
}
}
return matches
})