We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4073625 commit e31ad36Copy full SHA for e31ad36
src/lexer.c
@@ -73,7 +73,10 @@ void skip_whitespace(void)
73
}
74
if (is_whitespace(next_char) ||
75
(skip_newline && is_newline(next_char))) {
76
- next_char = dynarr_get_byte(SOURCE, ++source_idx);
+ if (++source_idx >= SOURCE->size) {
77
+ return;
78
+ }
79
+ next_char = dynarr_get_byte(SOURCE, source_idx);
80
continue;
81
82
break;
@@ -82,7 +85,9 @@ void skip_whitespace(void)
85
83
86
char read_char(bool is_skip_space)
84
87
{
88
+ if (++source_idx >= SOURCE->size)
89
+ return 0;
90
91
if (is_skip_space)
92
skip_whitespace();
93
return next_char;
0 commit comments