From fed941ce242496d1cffe8955a8842f37063bcf7e Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 25 Nov 2008 18:39:04 +0000 Subject: 26091: crash at end of history line if history not in use --- Src/hist.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Src') diff --git a/Src/hist.c b/Src/hist.c index 65812dc91..838c06993 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -1130,12 +1130,14 @@ hend(Eprog prog) && (hist_ignore_all_dups = isset(HISTIGNOREALLDUPS)) != 0) histremovedups(); - /* - * Added the following in case the test "hptr < chline + 1" - * is more than just paranoia. - */ - DPUTS(hptr < chline, "History end pointer off start of line"); - *hptr = '\0'; + if (hptr) { + /* + * Added the following in case the test "hptr < chline + 1" + * is more than just paranoia. + */ + DPUTS(hptr < chline, "History end pointer off start of line"); + *hptr = '\0'; + } addlinknode(hookargs, "zshaddhistory"); addlinknode(hookargs, chline); callhookfunc("zshaddhistory", hookargs, 1, &hookret); -- cgit 1.4.1