From c0ea4d62c81f7480192b1f61649f82d064dcb716 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 28 Aug 2001 08:41:51 +0000 Subject: handle possible NULL pointer returned from bufferwords() (15717) --- Src/Zle/zle_misc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Src/Zle/zle_misc.c') diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c index 2a650af86..e24d0c08b 100644 --- a/Src/Zle/zle_misc.c +++ b/Src/Zle/zle_misc.c @@ -549,13 +549,13 @@ copyprevshellword(char **args) int i; char *p = NULL; - l = bufferwords(NULL, NULL, &i); + if ((l = bufferwords(NULL, NULL, &i))) + for (n = firstnode(l); n; incnode(n)) + if (!i--) { + p = getdata(n); + break; + } - for (n = firstnode(l); n; incnode(n)) - if (!i--) { - p = getdata(n); - break; - } if (p) { int len = strlen(p); -- cgit 1.4.1