[2753] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

Re: [PATCH] Remove the echochar hack in owl_command_edit_cancel

daemon@ATHENA.MIT.EDU (Nelson Elhage)
Sun Nov 7 08:32:12 2010

From: Nelson Elhage <nelhage@MIT.EDU>
To: David Benjamin <davidben@mit.edu>, barnowl-dev@mit.edu
In-Reply-To: <1289106103-1798-1-git-send-email-davidben@mit.edu>
Date: Sun, 07 Nov 2010 08:32:08 -0500

lgtm

On Sun,  7 Nov 2010 01:01:43 -0400, David Benjamin <davidben@MIT.EDU> wrote:
> owl_function_start_password passes a NULL history, so there
> is no need for this. While we're at it, explicitly check for NULL
> history in places. While owl_history_* already checks, it's a bit
> sketchy.
> ---
>  commands.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/commands.c b/commands.c
> index 5cbe262..e639cb4 100644
> --- a/commands.c
> +++ b/commands.c
> @@ -2710,8 +2710,8 @@ void owl_command_edit_cancel(owl_editwin *e)
>  
>    owl_function_makemsg("Command cancelled.");
>  
> -  if(owl_editwin_get_echochar(e) == 0) {
> -    hist=owl_editwin_get_history(e);
> +  hist = owl_editwin_get_history(e);
> +  if (hist) {
>      owl_history_store(hist, owl_editwin_get_text(e));
>      owl_history_reset(hist);
>    }
> @@ -2725,6 +2725,8 @@ void owl_command_edit_history_prev(owl_editwin *e)
>    const char *ptr;
>  
>    hist=owl_editwin_get_history(e);
> +  if (!hist)
> +    return;
>    if (!owl_history_is_touched(hist)) {
>      owl_history_store(hist, owl_editwin_get_text(e));
>      owl_history_set_partial(hist);
> @@ -2744,6 +2746,8 @@ void owl_command_edit_history_next(owl_editwin *e)
>    const char *ptr;
>  
>    hist=owl_editwin_get_history(e);
> +  if (!hist)
> +    return;
>    ptr=owl_history_get_next(hist);
>    if (ptr) {
>      owl_editwin_clear(e);
> -- 
> 1.7.3.1.g716de
> 
> 

home help back first fref pref prev next nref lref last post