Skip to content

Commit

Permalink
Avoid walking off the ends of strings and arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Aug 24, 2010
1 parent a2ef165 commit 799f0e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Partcl/commands/file.pm
Expand Up @@ -157,13 +157,13 @@ my sub dirname($filename) {
my %PConfig := pir::getinterp[8]; ## .IGLOBALS_CONFIG_HASH
my $slash := %PConfig<slash>;

if pir::substr($filename, -1, 1) eq $slash {
if pir::length($filename) > 1 && pir::substr($filename, -1, 1) eq $slash {
$filename := pir::chopn__ssi($filename, 1);
}

my @array := pir::split($slash, $filename);

if @array[+@array-1] ne "" {
if +@array && @array[+@array-1] ne "" {
@array.pop();
}

Expand Down

0 comments on commit 799f0e7

Please sign in to comment.