]> www.git.momoyon.org Git - lang.git/commitdiff
[main.c] Check and error out on empty file.
authormomoyon <momoyon@momoyon.org>
Sun, 11 May 2025 06:20:18 +0000 (11:20 +0500)
committermomoyon <momoyon@momoyon.org>
Sun, 11 May 2025 06:20:18 +0000 (11:20 +0500)
main.c

diff --git a/main.c b/main.c
index 2569dc828517d1ce770bf9217f4ca32d7f05dbd8..2c67c93290a3c7fb9435ec3bb4d2636214cbcf45 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1627,6 +1627,11 @@ int main(int argc, char **argv) {
 
     Lexer l = make_lexer(filename);
 
+    if (l.src.count == 0) {
+        log_error("That's an empty file, I don't know what to do with it...");
+        return 1;
+    }
+
     Tokens tokens = lex(&l);
 
     if (dump_tokens) {