about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/hist.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0677bf36f..2196db3de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-19  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 44142: Src/hist.c: fix bug stripping spaces on line with only
+	comment.
+
 2019-03-18  Matthew Martin  <phy1729@gmail.com>
 
 	* 44135: Completion/Unix/Command/_chmod, Doc/Zsh/mod_files.yo,
diff --git a/Src/hist.c b/Src/hist.c
index f7e53de74..901cd3b1a 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1198,8 +1198,9 @@ histreduceblanks(void)
 	chline[pos] = '\0';
     } else {
 	ptr = chline + pos;
-	while ((*ptr++ = *lastptr++))
-	    ;
+	if (ptr < lastptr)
+	    while ((*ptr++ = *lastptr++))
+		;
     }
 }