Fix populate with an emply ([]) has_many
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index a8e468c..b1f3360 100644 (file)
@@ -1971,7 +1971,7 @@ sub populate {
     foreach my $item (@$data) {
 
       foreach my $rel (@rels) {
-        next unless $item->{$rel} && ref $item->{$rel} eq "ARRAY";
+        next unless ref $item->{$rel} eq "ARRAY" && @{ $item->{$rel} };
 
         my $parent = $self->find({map { $_ => $item->{$_} } @pks})
      || $self->throw_exception('Cannot find the relating object.');