commit 02a3a25aa0263d19bd4fb1124fdd1503eebca74c
parent c43c0487836c8738ce6f95d6c4b671896786051f
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 10 Nov 2015 10:39:12 +0000
Skipping a zero-length match only when there /is/ a match.
(Finally I understood what valgrind was complaining about.)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5398 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-10 Benno Schulenberg <bensberg@justemail.net>
+ * src/winio.c (edit_draw): Skip a zero-length match only when there
+ /is/ a match. Found with valgrind. This fixes Savannah bug #41908.
+
2015-11-08 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Allow exiting from the file browser
with the same key (^T) as it was entered (as ^G for the help viewer).
diff --git a/src/winio.c b/src/winio.c
@@ -2613,7 +2613,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
goto step_two;
/* Skip over a zero-length regex match. */
- if (startmatch.rm_so == startmatch.rm_eo)
+ if (start_line != NULL && startmatch.rm_so == startmatch.rm_eo)
startmatch.rm_eo++;
else {
/* If no start was found, skip to the next step. */