command/hide-cursor: fix crash on missing option

This commit is contained in:
Peter Kaplan 2022-04-14 19:50:49 +02:00 committed by Isaac Freund
parent 0b8758a422
commit a8491eb13e

View File

@ -30,6 +30,7 @@ pub fn cursor(
args: []const [:0]const u8, args: []const [:0]const u8,
_: *?[]const u8, _: *?[]const u8,
) Error!void { ) Error!void {
if (args.len < 2) return Error.NotEnoughArguments;
if (std.mem.eql(u8, "timeout", args[1])) { if (std.mem.eql(u8, "timeout", args[1])) {
if (args.len < 3) return Error.NotEnoughArguments; if (args.len < 3) return Error.NotEnoughArguments;
if (args.len > 3) return Error.TooManyArguments; if (args.len > 3) return Error.TooManyArguments;