From ae42240c33baa3631b80c7e0ca9e8dfa641e3c46 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 25 Jan 2016 20:26:01 +0000 Subject: [PATCH] Handling an update of the first element correctly. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5589 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c495de5c..70f1b985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-01-25 Benno Schulenberg + * src/files.c (update_poshistory): Handle an update of the first + element correctly. + 2016-01-24 Benno Schulenberg * src/files.c (update_poshistory): Move an updated item to the end of the list, so that it won't be dropped any time soon. The problem diff --git a/src/files.c b/src/files.c index 51e9c9cf..29e7ab6c 100644 --- a/src/files.c +++ b/src/files.c @@ -3208,7 +3208,10 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos) else posprev->next = theone; } else if (posptr->next != NULL) { - posprev->next = posptr->next; + if (posprev == NULL) + position_history = posptr->next; + else + posprev->next = posptr->next; while (posptr->next != NULL) posptr = posptr->next; posptr->next = theone; -- 2.39.5