]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - indirect.xs
Don't segfault for indirect constructs inside the empty package
[perl/modules/indirect.git] / indirect.xs
index de41fa61802e60fff95101fd70cea563d3328313..511d9cd81df75d069f87cbe101929a9af17117e0 100644 (file)
@@ -587,7 +587,8 @@ STATIC OP *indirect_ck_const(pTHX_ OP *o) {
      * when we already had a match because __PACKAGE__ can only appear in
      * direct method calls ("new __PACKAGE__" is a syntax error). */
     len = SvCUR(sv);
-    if (len == (STRLEN) HvNAMELEN_get(PL_curstash)
+    if (PL_curstash
+        && len == (STRLEN) HvNAMELEN_get(PL_curstash)
         && memcmp(SvPVX(sv), HvNAME_get(PL_curstash), len) == 0) {
      STRLEN pos_pkg;
      SV    *pkg = sv_newmortal();