This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Restore null checks to stashpv_hvname_match [perl #101430]
authorFather Chrysostomos <sprout@cpan.org>
Sun, 16 Oct 2011 20:18:46 +0000 (13:18 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Oct 2011 20:19:05 +0000 (13:19 -0700)
Commit aa33328e8 inadvertently removed the null checks from
stashpv_hvname_match when adding UTF8 support, resulting in crashes it
List::Gen’s test suite.

util.c

diff --git a/util.c b/util.c
index 7583d23..1df5453 100644 (file)
--- a/util.c
+++ b/util.c
@@ -5837,6 +5837,8 @@ Perl_stashpv_hvname_match(pTHX_ const COP *c, const HV *hv)
     PERL_UNUSED_CONTEXT;
     PERL_ARGS_ASSERT_STASHPV_HVNAME_MATCH;
 
+    if (!stashpv || !name)
+       return stashpv == name;
     if ( HvNAMEUTF8(hv) && !(CopSTASH_flags(c) & SVf_UTF8 ? 1 : 0) ) {
         if (CopSTASH_flags(c) & SVf_UTF8) {
             return (bytes_cmp_utf8(