summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-06-05 00:30:22 +0000
committerchristos <christos@NetBSD.org>2012-06-05 00:30:22 +0000
commitaebfd31373b7bb551f03b31d8e9f2edfbb45d49f (patch)
tree733e923a9f9f91af8ac41136dc41e404803a9450 /lib/libedit
parentc8716e7a323029c8b9a1d5e8aa962b8b31d9148a (diff)
don't crash if add_history is called from an empty line. Called from
nslookup in new bind. XXX: pullup to 6
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/readline.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index ddb3840029c..67beaaf5ef6 100644
--- a/lib/libedit/readline.c
+++ b/lib/libedit/readline.c
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.103 2012/05/15 19:07:25 christos Exp $ */
+/* $NetBSD: readline.c,v 1.104 2012/06/05 00:30:22 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.103 2012/05/15 19:07:25 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.104 2012/06/05 00:30:22 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -1372,6 +1372,9 @@ add_history(const char *line)
{
HistEvent ev;
+ if (line == NULL)
+ return 0;
+
if (h == NULL || e == NULL)
rl_initialize();