Raise an error if too few arguments are provided

This is a notably better user experience than an assert failing.
This commit is contained in:
Max Bernstein 2019-10-22 19:28:12 -07:00
parent 0a2247726a
commit 0a6e6c28c9
1 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,9 @@ if (is_equal(argv[1], "run")) {
// Outside of tests, traces must be explicitly requested.
if (Trace_file.is_open()) Trace_stream = new trace_stream;
trace(2, "run") << "=== Starting to run" << end();
assert(argc > 2);
if (argc <= 2) {
raise << "Not enough arguments provided.\n" << die();
}
reset();
cerr << std::hex;
load_elf(argv[2], argc, argv);