Skip to content

Commit a3b68c0

Browse files
committed
Allocate the stack array if null
1 parent 754394c commit a3b68c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/scanner.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,9 @@ unsigned tree_sitter_kotlin_external_scanner_serialize(void *payload, char *buff
521521
void tree_sitter_kotlin_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) {
522522
Stack *stack = (Stack *)payload;
523523
if (length > 0) {
524+
if (!stack->contents) {
525+
stack->contents = malloc(length);
526+
}
524527
memcpy(stack->contents, buffer, length);
525528
stack->size = length;
526529
} else {

0 commit comments

Comments
 (0)