diff options
| author | FourteenBrush <74827262+FourteenBrush@users.noreply.github.com> | 2024-08-14 21:37:40 +0200 |
|---|---|---|
| committer | FourteenBrush <74827262+FourteenBrush@users.noreply.github.com> | 2024-08-14 21:37:40 +0200 |
| commit | 12813e5d48a3bb0976abfdf63ffe7fbfa2f37aed (patch) | |
| tree | b508e6c4d60ae1998031dbfbbeef3df01739fc91 | |
| parent | f7234e2ed3b2ea167d5fdbef1bdb92b96b9a053b (diff) | |
Fix 'odin [run|test] --' giving a compiler out of bounds
| -rw-r--r-- | src/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp index 41a95338b..77758b929 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2973,13 +2973,19 @@ int main(int arg_count, char const **arg_ptr) { break; } } - if(run_args_start_idx != -1) { + if (run_args_start_idx != -1) { last_non_run_arg = run_args_start_idx; + + if (run_args_start_idx == 2) { + // missing src path on argv[2], invocation: odin [run|test] -- + usage(args[0]); + return 1; + } + for(isize i = run_args_start_idx+1; i < args.count; ++i) { array_add(&run_args, args[i]); } } - args = array_slice(args, 0, last_non_run_arg); run_args_string = string_join_and_quote(heap_allocator(), run_args); |