Skip to content

Commit

Permalink
Merge pull request #520 from skids/glr3
Browse files Browse the repository at this point in the history
Prevent generation of X::Cannot::Empty Failures in :nth processing.
  • Loading branch information
FROGGS committed Aug 29, 2015
2 parents f35d9de + 918cf63 commit a977dc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Str.pm
Expand Up @@ -687,11 +687,11 @@ my class Str does Stringy { # declared in BOOTSTRAP
@matches := (gather do for $matches -> $m {
state $i = 0;
state $took = 0;
state $n = $idxs.shift;
state $n = $idxs.EXISTS-POS(0) ?? $idxs.shift !! Nil;
last unless $n.defined;

if $i == $n {
$n = $idxs.shift;
$n = $idxs.EXISTS-POS(0) ?? $idxs.shift !! Nil;
take $m;
$took++;
last if $took >= $clip.max;
Expand Down

0 comments on commit a977dc3

Please sign in to comment.