From 90b959a6777c01c52d76203fb4e95bc8c5c0af01 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Wed, 21 Dec 2016 17:26:12 +0100
Subject: [PATCH] history: avoid crashing when the positionlog file is
 malformed

---
 src/files.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/files.c b/src/files.c
index 9ecad057..205f18ed 100644
--- a/src/files.c
+++ b/src/files.c
@@ -3192,7 +3192,11 @@ void load_poshistory(void)
 
 	    /* Find where the x index and line number are in the line. */
 	    xptr = revstrstr(line, " ", line + read - 3);
+	    if (xptr == NULL)
+		continue;
 	    lineptr = revstrstr(line, " ", xptr - 2);
+	    if (lineptr == NULL)
+		continue;
 
 	    /* Now separate the three elements of the line. */
 	    *(xptr++) = '\0';
-- 
GitLab