From: Arthur Axel 'fREW' Schmidt Date: Sat, 20 Mar 2010 19:50:46 +0000 (-0500) Subject: rework code a bit and die on a logic error X-Git-Tag: v0.001000_01~76 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3bc8ff9fe93d95c1151017eef8f44c69fe74c8d;p=dbsrgits%2FDBIx-Class-DeploymentHandler.git rework code a bit and die on a logic error --- diff --git a/lib/DBIx/Class/DeploymentHandler/VersionHandler/ExplicitVersions.pm b/lib/DBIx/Class/DeploymentHandler/VersionHandler/ExplicitVersions.pm index fd20600..62ba103 100644 --- a/lib/DBIx/Class/DeploymentHandler/VersionHandler/ExplicitVersions.pm +++ b/lib/DBIx/Class/DeploymentHandler/VersionHandler/ExplicitVersions.pm @@ -67,15 +67,14 @@ sub next_version_set { # sub instead of method because of when roles get compose my $self = shift; return undef if $self->ordered_versions->[$self->_version_idx] eq $self->to_version; + my $next_idx = $self->_inc_version_idx; - if ( $next_idx <= $#{ $self->ordered_versions }) { - return [ - $self->ordered_versions->[$next_idx - 1], - $self->ordered_versions->[$next_idx ], - ] - } else { - return undef - } + return [ + $self->ordered_versions->[$next_idx - 1], + $self->ordered_versions->[$next_idx ], + ] if $next_idx <= $#{ $self->ordered_versions }; + + croak 'this should never happen'; } __PACKAGE__->meta->make_immutable;