Patch for situations when you broke DBIC, to get clearer error reporting behaviour
[catagits/Catalyst-Authentication-Store-DBIx-Class.git] / lib / Catalyst / Authentication / Store / DBIx / Class / User.pm
index 0bc8b6f..4e5319c 100644 (file)
@@ -261,7 +261,9 @@ sub can {
     my $self = shift;
     return $self->SUPER::can(@_) || do {
         my ($method) = @_;
-        if (my $code = $self->_user->can($method)) {
+        if (not $self->_user) {
+            undef;
+        } elsif (my $code = $self->_user->can($method)) {
             sub { shift->_user->$code(@_) }
         } elsif (my $accessor =
             try { $self->_user->result_source->column_info($method)->{accessor} }) {