From 9a9b1955bcb5b2f62e805110244cc1cdfa010f99 Mon Sep 17 00:00:00 2001 From: Oldes Date: Mon, 25 Jun 2018 11:41:12 +0200 Subject: [PATCH] ATRONIX/FIX: Fix break from remove-each Reported by MichaT from altme. This is what the actual result: >> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s 1 2 == [3 4] This is what's expected: >> remove-each n s: [ 1 2 3 4] [ print n if n = 2 [ break] true ] s 1 2 == [2 3 4] Fixes: https://github.com/rebol/rebol-issues/issues/2192 (cherry picked from commit b3364594eff99aeef092d57fda0e51cb1335b5e4) --- src/core/n-loop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/n-loop.c b/src/core/n-loop.c index edf3a128f1..c2961a0e80 100644 --- a/src/core/n-loop.c +++ b/src/core/n-loop.c @@ -419,7 +419,10 @@ ds = Do_Blk(body, 0); if (THROWN(ds)) { - if ((err = Check_Error(ds)) >= 0) break; + if ((err = Check_Error(ds)) >= 0) { + index = rindex; + break; + } // else CONTINUE: if (mode == 1) SET_FALSE(ds); // keep the value (for mode == 1) } else {