Fixes #88913: Make sure to always read the languageId/tokenType metadata from a valid TM token index

This commit is contained in:
Alex Dima 2020-01-24 12:48:35 +01:00
parent 365c034866
commit c5c2551f7c
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0

View file

@ -804,7 +804,7 @@ export class TokensStore2 {
aIndex++;
}
const aMetadata = aTokens.getMetadata(aIndex - 1 > 0 ? aIndex - 1 : aIndex);
const aMetadata = aTokens.getMetadata(Math.min(Math.max(0, aIndex - 1), aLen - 1));
const languageId = TokenMetadata.getLanguageId(aMetadata);
const tokenType = TokenMetadata.getTokenType(aMetadata);