diff options
-rw-r--r-- | gv.c | 5 | ||||
-rw-r--r-- | mg.c | 2 | ||||
-rw-r--r-- | t/op/attrs.t | 4 |
3 files changed, 10 insertions, 1 deletions
@@ -1259,9 +1259,12 @@ CV* Perl_gv_handler(pTHX_ HV *stash, I32 id) { dTHR; - MAGIC *mg = mg_find((SV*)stash,'c'); + MAGIC *mg; AMT *amtp; + if (!stash) + return Nullcv; + mg = mg_find((SV*)stash,'c'); if (!mg) { do_update: Gv_AMupdate(stash); @@ -261,6 +261,8 @@ MAGIC* Perl_mg_find(pTHX_ SV *sv, int type) { MAGIC* mg; + if (!sv) + return 0; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { if (mg->mg_type == type) return mg; diff --git a/t/op/attrs.t b/t/op/attrs.t index 2702004881..f9212e4c26 100644 --- a/t/op/attrs.t +++ b/t/op/attrs.t @@ -142,6 +142,10 @@ eval 'my A $x : plugh plover;'; mytest qr/^SCALAR package attributes may clash with future reserved words: ["']?plugh["']? /; BEGIN {++$ntests} +eval 'package Cat; my Cat @socks;'; +mytest qr/^Can't declare class for non-scalar \@socks in "my"/; +BEGIN {++$ntests} + sub X::MODIFY_CODE_ATTRIBUTES { die "$_[0]" } sub X::foo { 1 } *Y::bar = \&X::foo; |