Merge branch 'nd/fetch-ref-summary'
[gitweb.git] / xdiff / xemit.c
index bfa53d3dcd2e472017309ad764543334780408cc..49aa16ff78d8c0f10942e0f519543cc6befabb9d 100644 (file)
@@ -246,7 +246,8 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
                         * its new end.
                         */
                        if (xche->next) {
-                               long l = xche->next->i1;
+                               long l = XDL_MIN(xche->next->i1,
+                                                xe->xdf1.nrec - 1);
                                if (l <= e1 ||
                                    get_func_line(xe, xecfg, NULL, l, e1) < 0) {
                                        xche = xche->next;