add error for non-lv2 args not getting enough args
This commit is contained in:
parent
2a801a129b
commit
b28f208e65
1 changed files with 8 additions and 4 deletions
12
src/lang.zig
12
src/lang.zig
|
@ -527,9 +527,6 @@ pub const Lang = struct {
|
||||||
else => true,
|
else => true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: crash when no arguments are left but we still need
|
|
||||||
// arguments...
|
|
||||||
|
|
||||||
if (is_lv2_command) {
|
if (is_lv2_command) {
|
||||||
const split = tok_it.next();
|
const split = tok_it.next();
|
||||||
if (split == null) {
|
if (split == null) {
|
||||||
|
@ -571,7 +568,14 @@ pub const Lang = struct {
|
||||||
continue;
|
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) {
|
const argument_value = switch (cmd_field.field_type) {
|
||||||
usize => try std.fmt.parseInt(usize, arg, 10),
|
usize => try std.fmt.parseInt(usize, arg, 10),
|
||||||
i32 => try std.fmt.parseInt(i32, arg, 10),
|
i32 => try std.fmt.parseInt(i32, arg, 10),
|
||||||
|
|
Loading…
Reference in a new issue