From 2793cb42c554ddf216f1ffc5a6d2a867adcd6c0d Mon Sep 17 00:00:00 2001 From: "Chas. Owens" Date: Thu, 16 Sep 2010 16:59:30 +0200 Subject: 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. --- ext/Hash-Util/lib/Hash/Util.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext') 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); -- cgit v1.2.1