Merge pull request #3652 from eliandoran/fix/infinite_loop_autocompletion

Infinite loop when searching for '' in Jump to note
This commit is contained in:
zadam 2023-03-14 22:13:40 +01:00 committed by GitHub
commit 53aaffd0f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,6 +331,11 @@ function highlightSearchResults(searchResults, highlightedTokens) {
} }
for (const token of highlightedTokens) { for (const token of highlightedTokens) {
if (!token) {
// Avoid empty tokens, which might cause an infinite loop.
continue;
}
for (const result of searchResults) { for (const result of searchResults) {
// Reset token // Reset token
const tokenRegex = new RegExp(utils.escapeRegExp(token), "gi"); const tokenRegex = new RegExp(utils.escapeRegExp(token), "gi");