convert to using EUMM::Dist::Zilla::Develop
[gitmo/Package-Stash-XS.git] / XS.xs
diff --git a/XS.xs b/XS.xs
index 5957b1a..b0519de 100644 (file)
--- a/XS.xs
+++ b/XS.xs
@@ -213,11 +213,11 @@ int _valid_for_type(SV *value, vartype_t type)
 
     switch (type) {
     case VAR_SCALAR:
-        return sv_type == SVt_NULL ||
-               sv_type == SVt_IV   ||
-               sv_type == SVt_NV   ||
-               sv_type == SVt_PV   ||
-               sv_type == SVt_RV;
+        /* XXX: something weird is going on here - apparently values can
+         * be SVt_NULL but also be SvROK (and also, SVt_NULL isn't SvOK) */
+        if (sv_type == SVt_NULL)
+            return 1;
+        return SvROK(value) ? SvOK(SvRV(value)) : SvOK(value);
     case VAR_ARRAY:
         return sv_type == SVt_PVAV;
     case VAR_HASH: