]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - Upper.xs
Disallow reference localization targets
[perl/modules/Scope-Upper.git] / Upper.xs
index 5bf3b496797c67bf67de422a6679e78e27382f3d..75c50934fa9abb290200ffc25dd5a496dde41346 100644 (file)
--- a/Upper.xs
+++ b/Upper.xs
@@ -380,6 +380,9 @@ STATIC void su_ud_localize_init(pTHX_ su_ud_localize *ud, SV *sv, SV *val, SV *e
    t = SvTYPE(SvRV(val));
    deref = 1;
   }
+ } else if (SvROK(sv)) {
+  croak("Invalid %s reference as the localization target",
+                 sv_reftype(SvRV(sv), 0));
  } else {
   STRLEN len, l;
   const char *p = SvPV_const(sv, len), *s;