ed: Fix infinite recursion to undo()

This commit is contained in:
Roberto E. Vargas Caballero 2015-12-31 19:35:26 +00:00 committed by sin
parent a02d66b8fc
commit b08660e1fd
1 changed files with 3 additions and 1 deletions

4
ed.c
View File

@ -282,7 +282,7 @@ undo(void)
struct link *p;
if (udata.nr == 0)
error("nothing to undo");
return;
for (p = &udata.vec[udata.nr-1]; udata.nr--; --p) {
zero[p->from1].next = p->to1;
zero[p->from2].prev = p->to2;
@ -1101,6 +1101,8 @@ repeat:
if (nlines > 0)
goto bad_address;
chkprint(1);
if (udata.nr == 0)
error("nothing to undo");
undo();
break;
case 's':