Commit 9a6bf2a51049ad50a420483392c3dd7c8557dcaa

Stefan Sperling 2018-05-20T14:04:17

simplify tog log view scroll_down()

diff --git a/tog/tog.c b/tog/tog.c
index 8c00611..a0d98d2 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -515,12 +515,8 @@ scroll_down(struct commit_queue_entry **first_displayed_entry, int maxscroll,
 		pentry = TAILQ_NEXT(entry, entry);
 		if (pentry == NULL) {
 			err = fetch_parent_commit(&pentry, entry, repo);
-			if (err)
+			if (err || pentry == NULL)
 				break;
-			if (pentry == NULL) {
-				*first_displayed_entry = entry;
-				return NULL;
-			}
 			TAILQ_INSERT_TAIL(commits, pentry, entry);
 			last_displayed_entry = pentry;
 		}
@@ -536,7 +532,8 @@ scroll_down(struct commit_queue_entry **first_displayed_entry, int maxscroll,
 			if (pentry) {
 				TAILQ_INSERT_TAIL(commits, pentry, entry);
 				last_displayed_entry = pentry;
-			}
+			} else
+				break;
 		}
 	} while (++nscrolled < maxscroll);