Merge the common code from Perl_vdie and Perl_vwarner into a
[p5sagit/p5-mst-13.2.git] / universal.c
index 6b2214d..caab476 100644 (file)
  * beginning." --Gandalf, relating Gollum's story
  */
 
+/* This file contains the code that implements the functions in Perl's
+ * UNIVERSAL package, such as UNIVERSAL->can().
+ */
+
 #include "EXTERN.h"
 #define PERL_IN_UNIVERSAL_C
 #include "perl.h"
@@ -374,7 +378,7 @@ XS(XS_UNIVERSAL_VERSION)
                    vnumify(req),vnormal(req),vnumify(sv),vnormal(sv));
     }
 
-    if ( sv_derived_from(sv, "version") ) {
+    if ( SvOK(sv) && sv_derived_from(sv, "version") ) {
        ST(0) = vnumify(sv);
     } else {
        ST(0) = sv;