diff options
author | Chas. Owens <chas.owens@gmail.com> | 2010-09-16 16:59:30 +0200 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2010-09-16 17:02:33 +0200 |
commit | 2793cb42c554ddf216f1ffc5a6d2a867adcd6c0d (patch) | |
tree | 3e72832ee5b7d5e2cf4de744617fccf235b6a480 /ext/Hash-Util | |
parent | cba0b53980b869e0b7ceaf81166f64dd51ca7c12 (diff) | |
download | perl-2793cb42c554ddf216f1ffc5a6d2a867adcd6c0d.tar.gz |
reftype() used without checking for undef
Hash::Util used "reftype($v) eq 'HASH'" without checking for
undefinendness. This patch rectifies that. Also bumps Hash::Util
version.
Original patch and detective work by Chas. Owens. Modified by Steffen
Mueller.
Diffstat (limited to 'ext/Hash-Util')
-rw-r--r-- | ext/Hash-Util/lib/Hash/Util.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/Hash-Util/lib/Hash/Util.pm b/ext/Hash-Util/lib/Hash/Util.pm index 95da7d9419..49d38e0b9c 100644 --- a/ext/Hash-Util/lib/Hash/Util.pm +++ b/ext/Hash-Util/lib/Hash/Util.pm @@ -29,7 +29,7 @@ our @EXPORT_OK = qw( hash_seed hv_store ); -our $VERSION = '0.08'; +our $VERSION = '0.09'; require DynaLoader; local @ISA = qw(DynaLoader); bootstrap Hash::Util $VERSION; @@ -321,7 +321,8 @@ sub lock_hashref_recurse { lock_ref_keys($hash); foreach my $value (values %$hash) { - if (reftype($value) eq 'HASH') { + my $type = reftype($value); + if (defined($type) and $type eq 'HASH') { lock_hashref_recurse($value); } Internals::SvREADONLY($value,1); @@ -333,7 +334,8 @@ sub unlock_hashref_recurse { my $hash = shift; foreach my $value (values %$hash) { - if (reftype($value) eq 'HASH') { + my $type = reftype($value); + if (defined($type) and $type eq 'HASH') { unlock_hashref_recurse($value); } Internals::SvREADONLY($value,1); |