This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert(cSVOPo) before derefing it.
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 25 Jun 2015 00:19:55 +0000 (20:19 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sat, 27 Jun 2015 03:09:46 +0000 (23:09 -0400)
op.c

diff --git a/op.c b/op.c
index 2c2c520..d78a46e 100644 (file)
--- a/op.c
+++ b/op.c
@@ -8449,9 +8449,14 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs,
        gv = gv_fetchpvs("__ANON__::__ANON__", gv_fetch_flags, SVt_PVCV);
        has_name = FALSE;
     }
-    if (!ec)
-       move_proto_attr(&proto, &attrs,
-                       isGV(gv) ? gv : (GV *)cSVOPo->op_sv);
+    if (!ec) {
+        if (isGV(gv)) {
+            move_proto_attr(&proto, &attrs, gv);
+        } else {
+            assert(cSVOPo);
+            move_proto_attr(&proto, &attrs, (GV *)cSVOPo->op_sv);
+        }
+    }
 
     if (proto) {
        assert(proto->op_type == OP_CONST);