Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for RT#112868
  • Loading branch information
perlpilot committed Jul 18, 2015
1 parent 9eb336f commit 4b5e196
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/Str.pm
Expand Up @@ -926,11 +926,17 @@ my class Str does Stringy { # declared in BOOTSTRAP
}
}, 1 .. $l;
} else {
# Add one more to the limit to get the trailing empty string
$l = $l + 1 if nqp::istype($limit, Whatever) || $limit == Inf;
my int $chars = nqp::chars($self-string);
map {
last if $done;

if ($chars = $chars - 1) and ($l = $l - 1) {
if $_ == 1 {
$l = $l - 1;
""
} elsif $chars > 0 && $l > 1 {
$chars = $chars - 1; $l = $l - 1;
my \value = nqp::p6box_s(nqp::substr($self-string, $c, 1));
$c = $c + 1;
value
Expand Down

0 comments on commit 4b5e196

Please sign in to comment.