From: Dave Rolsky Date: Sun, 5 Apr 2009 21:15:40 +0000 (-0500) Subject: Handle undef without warnings in class_of X-Git-Tag: 0.80_01~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=82999986c7574b020e731b914db1d58f9265f7e3;p=gitmo%2FClass-MOP.git Handle undef without warnings in class_of --- diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index ab68861..6fd22a6 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -62,6 +62,7 @@ XSLoader::load( __PACKAGE__, $XS_VERSION ); # This handles instances as well as class names sub class_of { + return unless defined $_[0]; my $class = blessed($_[0]) || $_[0]; return $METAS{$class}; }