Skip to content

Commit 4213bbe

Browse files
committed
Don't allocate a token run if the text has no more characters.
Based on this commit by JensOgorek: zauberzeug#6
1 parent aeb02a7 commit 4213bbe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/x-tokenize.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ static bool OWL_DONT_INLINE
236236
owl_default_tokenizer_advance(struct owl_default_tokenizer *tokenizer,
237237
struct owl_token_run **previous_run)
238238
{
239+
if (tokenizer->text[tokenizer->offset] == '\0')
240+
return false;
239241
struct owl_token_run *run = malloc(sizeof(struct owl_token_run));
240242
if (!run)
241243
return false;

0 commit comments

Comments
 (0)