1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
commit 48dd250af1ee7d097ed89ad793428a4ce139f381
Author: nicm <nicm>
Date: Sun Oct 9 07:58:35 2016 +0000
Handle NULL window or session for user options.
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -232,6 +232,7 @@
struct winlink *wl = cmdq->state.tflag.wl;
struct options *oo;
struct options_entry *o;
+ const char *target;
if (args_has(args, 's'))
oo = global_options;
@@ -239,12 +240,28 @@
self->entry == &cmd_set_window_option_entry) {
if (args_has(self->args, 'g'))
oo = global_w_options;
- else
+ else if (wl == NULL) {
+ target = args_get(args, 't');
+ if (target != NULL) {
+ cmdq_error(cmdq, "no such window: %s",
+ target);
+ } else
+ cmdq_error(cmdq, "no current window");
+ return (CMD_RETURN_ERROR);
+ } else
oo = wl->window->options;
} else {
if (args_has(self->args, 'g'))
oo = global_s_options;
- else
+ else if (s == NULL) {
+ target = args_get(args, 't');
+ if (target != NULL) {
+ cmdq_error(cmdq, "no such session: %s",
+ target);
+ } else
+ cmdq_error(cmdq, "no current session");
+ return (CMD_RETURN_ERROR);
+ } else
oo = s->options;
}
|