summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xemit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index bfa53d3dcd..49aa16ff78 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -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;