diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-10 08:17:35 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-10 08:17:35 +0200 |
commit | 9c95991fcefa80ab54e3bc39aa3b66f2b44d05f0 (patch) | |
tree | 9b34b84e61afa402477d07295bc2b47667163896 /src/actions.c | |
parent | b512806d40ca771ce9ee74b47e5a828ad6039e7c (diff) | |
download | ratpoison-9c95991fcefa80ab54e3bc39aa3b66f2b44d05f0.zip |
cmd_prompt: handle NULL output
* if the user aborted we receive a NULL pointer; don't attempt to
dereference it, and treat this case as a failure.
Matches the behaviour of cmd_colon and cmd_select
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/actions.c b/src/actions.c index e61497e..fa5af52 100644 --- a/src/actions.c +++ b/src/actions.c @@ -5826,9 +5826,13 @@ cmd_prompt (int interactive UNUSED, struct cmdarg **args) output = get_input (ARG_STRING(0), hist_PROMPT, trivial_completions); } } + + if (output == NULL) + return cmdret_new (RET_FAILURE, NULL); /* User aborted */ + ret = cmdret_new (RET_SUCCESS, "%s", output); - if (output) - free (output); + free (output); + return ret; } |