- next if grep { $dst_isle == $_ } @islandids[$org_i..$dst_i-1];
- next if grep { $org_isle == $_ } @islandids[$org_i+1..$dst_i];
- my $dst_cond= $sd_condition->('buy',$dst_i);
+ next if defined $dst_isle and
+ grep { $dst_isle == $_ } @islandids[$org_i..$dst_i-1];
+ next if defined $org_isle and
+ grep { $org_isle == $_ } @islandids[$org_i+1..$dst_i];
+ my $dst_cond;