From: Travis Cross Date: Thu, 22 Sep 2011 03:20:56 +0000 (+0000) Subject: fs_cli: fix segfault if a pressed function key is not bound X-Git-Tag: v1.2-rc1~51^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbe8b9d55d24aceebd04ec89ca4e6ebf1f8041fc;p=thirdparty%2Ffreeswitch.git fs_cli: fix segfault if a pressed function key is not bound --- diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 5a68640633..f9d77f9da4 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -100,12 +100,12 @@ static unsigned char console_fnkey_pressed(int i) { const char *c; assert((i > 0) && (i <= 12)); - c = global_profile->console_fnkeys[i - 1]; - printf("%s\n", c); - if (c == NULL) { + if (!(c = global_profile->console_fnkeys[i - 1])) { + printf("\n"); esl_log(ESL_LOG_ERROR, "FUNCTION KEY F%d IS NOT BOUND, please edit your config.\n", i); return CC_REDISPLAY; } + printf("%s\n", c); if (process_command(global_handle, c)) { running = thread_running = 0; }