aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-09-29 12:17:15 +0100
committergingerBill <bill@gingerbill.org>2023-09-29 12:17:15 +0100
commit3fae38a2f815681cfbfe22122dd28698a5196803 (patch)
tree56d0a369e97c013c6b3b8bd0b01e1ce1d65f2241 /src/parser.cpp
parent23054138c2d3120e99e79b05bbc855cf7353bb04 (diff)
Correct `get_file_line_as_string` to fix #2829
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index a4bf949b9..a81594663 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -36,6 +36,9 @@ gb_internal gbString get_file_line_as_string(TokenPos const &pos, i32 *offset_)
u8 *start = file->tokenizer.start;
u8 *end = file->tokenizer.end;
+ if (start == end) {
+ return nullptr;
+ }
isize len = end-start;
if (len < offset) {
return nullptr;