Skip to content

Commit

Permalink
Fix: Crash when defining tape
Browse files Browse the repository at this point in the history
As the tape wasn't allocated, there was a segmentation fault when the array was being accessed.
  • Loading branch information
QuickWrite committed Nov 21, 2024
1 parent 6cc265c commit db18062
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ static void parse_head(struct Lexer* const lexer, struct Head* head) {

// If the tape is larger than 0, the tape needs to be corrected.
if(head->tape_len > 0) {
head->tape = malloc(sizeof(Symbol) * head->tape_len);

for(size_t i = 0; i < head->tape_len; ++i) {
head->tape[i] = (Symbol)find_symbol(head, head->tape_elems[i]);
}
Expand Down

0 comments on commit db18062

Please sign in to comment.