diff options
author | nicm <nicm> | 2014-07-13 20:57:46 +0000 |
---|---|---|
committer | nicm <nicm> | 2014-07-13 20:57:46 +0000 |
commit | c5253ad8f7236662d0186dec1080288eb2d38b72 (patch) | |
tree | 52b41f8a2d39e733956e08e8bb08d14a6fca7f2a /cmd.c | |
parent | 2b67907176805e3df5bd913174617d768277bfff (diff) | |
download | rtmux-c5253ad8f7236662d0186dec1080288eb2d38b72.tar.gz rtmux-c5253ad8f7236662d0186dec1080288eb2d38b72.tar.bz2 rtmux-c5253ad8f7236662d0186dec1080288eb2d38b72.zip |
Show an error if cmd_find_session can't find the current session, like
the other functions.
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -795,8 +795,11 @@ cmd_find_session(struct cmd_q *cmdq, const char *arg, int prefer_unattached) int ambiguous; /* A NULL argument means the current session. */ - if (arg == NULL) - return (cmd_current_session(cmdq, prefer_unattached)); + if (arg == NULL) { + if ((s = cmd_current_session(cmdq, prefer_unattached)) == NULL) + cmdq_error(cmdq, "can't establish current session"); + return (s); + } /* Lookup as pane id or window id. */ if ((wp = cmd_lookup_paneid(arg)) != NULL) @@ -813,7 +816,9 @@ cmd_find_session(struct cmd_q *cmdq, const char *arg, int prefer_unattached) /* An empty session name is the current session. */ if (*tmparg == '\0') { free(tmparg); - return (cmd_current_session(cmdq, prefer_unattached)); + if ((s = cmd_current_session(cmdq, prefer_unattached)) == NULL) + cmdq_error(cmdq, "can't establish current session"); + return (s); } /* Find the session, if any. */ |