Skip to content

Commit

Permalink
Add protection to _replace_sub
Browse files Browse the repository at this point in the history
Fix #59
  • Loading branch information
atoomic committed Apr 25, 2024
1 parent 0ef70c5 commit fbab474
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Test/MockModule.pm
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ sub _replace_sub {
# save a copy of all non-code slots
my %slot;
foreach (qw(ARRAY FORMAT HASH IO SCALAR)) {
next unless defined(my $elem = *{$symbols{$sub}}{$_});
next unless defined $symbols{$sub} && defined(my $elem = *{$symbols{$sub}}{$_});
$slot{$_} = $elem;
}

Expand Down

0 comments on commit fbab474

Please sign in to comment.