chiark / gitweb /
routesearch: Use correct island pair when eliminating!
[ypp-sc-tools.web-live.git] / yarrg / rssearch.c
index eb40a47fbdeba5cb144118e53fc40b9de099ad82..d5a97a488604fb74db3f5c6ceaa7c686ef2613ed 100644 (file)
@@ -53,7 +53,8 @@ static double process_route(int nports, int totaldist,
     
     for (i=0; i<nports; i++) {
       pair[0]= ports[i];
-      IslandPair *ip= ipair_get(ports[nports-2], ports[nports-1]);
+      IslandPair *ip= ipair_get_maybe(pair[0], pair[1]);
+      if (!ip) continue;
       if (ip->route_tail_value < 0)
        ip->route_tail_value= value_route(2, pair, pair[0]!=pair[1]);
       guess_absolute += ip->route_tail_value;