add error for non-lv2 args not getting enough args

This commit is contained in:
Luna 2021-04-04 17:56:59 -03:00
parent 2a801a129b
commit b28f208e65

View file

@ -527,9 +527,6 @@ pub const Lang = struct {
else => true,
};
// TODO: crash when no arguments are left but we still need
// arguments...
if (is_lv2_command) {
const split = tok_it.next();
if (split == null) {
@ -571,7 +568,14 @@ pub const Lang = struct {
continue;
}
}
const arg = tok_it.next().?;
const arg_opt = tok_it.next();
if (arg_opt == null) {
self.doError("Expected parameter for {s}, got nothing", .{cmd_field.name});
return;
}
const arg = arg_opt.?;
const argument_value = switch (cmd_field.field_type) {
usize => try std.fmt.parseInt(usize, arg, 10),
i32 => try std.fmt.parseInt(i32, arg, 10),