This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A little bit more safe version of HvMROMETA
[perl5.git] / hv.h
diff --git a/hv.h b/hv.h
index 7fb9fc4..a5ea429 100644 (file)
--- a/hv.h
+++ b/hv.h
@@ -266,7 +266,9 @@ C<SV*>.
 #define HvRITER_get(hv)        (SvOOK(hv) ? HvAUX(hv)->xhv_riter : -1)
 #define HvEITER_get(hv)        (SvOOK(hv) ? HvAUX(hv)->xhv_eiter : 0)
 #define HvNAME(hv)     HvNAME_get(hv)
-#define HvMROMETA(hv)  (HvAUX(hv)->xhv_mro_meta ? HvAUX(hv)->xhv_mro_meta : mro_meta_init(hv))
+#define HvMROMETA(hv)  (SvOOK(hv) \
+                       ? (HvAUX(hv)->xhv_mro_meta ? HvAUX(hv)->xhv_mro_meta : mro_meta_init(hv)) \
+                       : NULL)
 /* FIXME - all of these should use a UTF8 aware API, which should also involve
    getting the length. */
 /* This macro may go away without notice.  */