Skip to content

Commit

Permalink
Update scanner.c
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMakaev authored Oct 9, 2024
1 parent d8fcf6a commit a39eedc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,10 @@ void tree_sitter_kotlin_external_scanner_destroy(void *payload) {

unsigned tree_sitter_kotlin_external_scanner_serialize(void *payload, char *buffer) {
Stack *stack = (Stack *)payload;
if (stack->size == 0) {
return 0;
if (stack->size > 0) {
// it's an undefined behavior to memcpy 0 bytes
memcpy(buffer, stack->contents, stack->size);
}
memcpy(buffer, stack->contents, stack->size);
return stack->size;
}

Expand Down

0 comments on commit a39eedc

Please sign in to comment.