commit b08660e1fd6935c2b79528fe3c776660474d77c6
parent a02d66b8fc651979b7f905f78722a6192896eb90
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 31 Dec 2015 19:35:26 +0000
ed: Fix infinite recursion to undo()
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -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':