mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Handle NULL value properly.
This commit is contained in:
parent
26b340964a
commit
c63d4ab80f
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-set-option.c,v 1.3 2007-10-04 22:04:01 nicm Exp $ */
|
/* $Id: cmd-set-option.c,v 1.4 2007-10-04 22:18:48 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -102,17 +102,24 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
number = strtonum(data->value, 0, UINT_MAX, &errstr);
|
if (data->value != NULL) {
|
||||||
|
number = strtonum(data->value, 0, UINT_MAX, &errstr);
|
||||||
|
|
||||||
bool = -1;
|
bool = -1;
|
||||||
if (number == 1 ||
|
if (number == 1 || strcmp(data->value, "on") == 0 ||
|
||||||
strcmp(data->value, "on") == 0 || strcmp(data->value, "yes") == 0)
|
strcmp(data->value, "yes") == 0)
|
||||||
|
bool = 1;
|
||||||
|
if (number == 0 || strcmp(data->value, "off") == 0 ||
|
||||||
|
strcmp(data->value, "no") == 0)
|
||||||
|
bool = 0;
|
||||||
|
} else
|
||||||
bool = 1;
|
bool = 1;
|
||||||
if (number == 0 ||
|
|
||||||
strcmp(data->value, "off") == 0 || strcmp(data->value, "no") == 0)
|
|
||||||
bool = 0;
|
|
||||||
|
|
||||||
if (strcmp(data->option, "prefix") == 0) {
|
if (strcmp(data->option, "prefix") == 0) {
|
||||||
|
if (data->value == NULL) {
|
||||||
|
ctx->error(ctx, "invalid value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
key = key_string_lookup_string(data->value);
|
key = key_string_lookup_string(data->value);
|
||||||
if (key == KEYC_NONE) {
|
if (key == KEYC_NONE) {
|
||||||
ctx->error(ctx, "unknown key: %s", data->value);
|
ctx->error(ctx, "unknown key: %s", data->value);
|
||||||
|
Loading…
Reference in New Issue
Block a user