-/* $OpenBSD: cmd.c,v 1.94 2014/05/13 08:08:32 nicm Exp $ */
+/* $OpenBSD: cmd.c,v 1.95 2014/07/13 20:57:46 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
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)
/* 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. */