changeset 16664:5bc6edf71b39

parsers: ensure that nullid is always present in the radix tree
author Bryan O'Sullivan <bryano@fb.com>
date Sat, 12 May 2012 10:55:08 +0200
parents a955e05dd7a0
children e410be860393
files mercurial/parsers.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/parsers.c	Sat May 12 10:55:07 2012 +0200
+++ b/mercurial/parsers.c	Sat May 12 10:55:08 2012 +0200
@@ -387,7 +387,7 @@
 	Py_ssize_t length = index_length(self);
 	const char *data;
 
-	if (pos == length - 1)
+	if (pos == length - 1 || pos == INT_MAX)
 		return nullid;
 
 	if (pos >= length)
@@ -671,6 +671,8 @@
 		self->ntrev = (int)index_length(self) - 1;
 		self->ntlookups = 1;
 		self->ntmisses = 0;
+		if (nt_insert(self, nullid, INT_MAX) == -1)
+			return -1;
 	}
 	return 0;
 }