diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -1286,7 +1286,9 @@ v = n->children[k]; if (v < 0) { v = -(v + 1); - const char *n = index_node(self, v); + const char *n = index_node_existing(self, v); + if (n == NULL) + return -3; if (memcmp(node, n, 20) != 0) /* * Found a unique prefix, but it wasn't for the