diff --git a/src/Surface.zig b/src/Surface.zig index 76c353969..d1ca54a8a 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -679,14 +679,16 @@ pub fn init( switch (initial_command) { // If a user specifies a command with `-e` it is appropriate to set the title // as argv[0] - .direct => { - _ = try rt_app.performAction( - .{ .surface = self }, - .set_title, - .{ .title = initial_command.direct[0] }, - ); + .direct => |cmd| { + if (cmd.len != 0) { + _ = try rt_app.performAction( + .{ .surface = self }, + .set_title, + .{ .title = cmd[0] }, + ); + } }, - // we won't set the title in the case the shell expands the command + // We won't set the title in the case the shell expands the command // as that should typically be used to launch a shell which should // set its own titles .shell => {},