From f9cd2187875b6f2ebdb9b9a787fac20b2aaf745b Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 23 Jul 2019 14:45:48 +0200 Subject: 44566: make sure Zle doesn't crash if history entry not found --- Src/Zle/zle_utils.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index 0277d4917..d549b885b 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -1607,7 +1607,12 @@ static int unapplychange(struct change *ch) { if(ch->hist != histline) { - zle_setline(quietgethist(ch->hist)); + Histent he = quietgethist(ch->hist); + if(!he) { + dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); + return 1; + } + zle_setline(he); zlecs = ch->new_cs; return 0; } @@ -1647,7 +1652,12 @@ static int applychange(struct change *ch) { if(ch->hist != histline) { - zle_setline(quietgethist(ch->hist)); + Histent he = quietgethist(ch->hist); + if(!he) { + dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); + return 1; + } + zle_setline(he); zlecs = ch->old_cs; return 0; } -- cgit 1.4.1