mercurial/cext/revlog.c
changeset 38852 a3dacabd476b
parent 38851 781b2720d2ac
child 38866 aa33988ad8ab
--- a/mercurial/cext/revlog.c	Fri Jul 20 08:10:32 2018 -0700
+++ b/mercurial/cext/revlog.c	Fri Jul 20 14:36:42 2018 -0700
@@ -158,12 +158,12 @@
 	Py_ssize_t length = index_length(self) + 1;
 	PyObject *entry;
 
-	if (pos == -1 || pos == length - 1) {
+	if (pos == -1) {
 		Py_INCREF(nullentry);
 		return nullentry;
 	}
 
-	if (pos < 0 || pos >= length) {
+	if (pos < 0 || pos >= length - 1) {
 		PyErr_SetString(PyExc_IndexError, "revlog index out of range");
 		return NULL;
 	}