Archived
0

fix throw exception if from place don't have stations

This commit is contained in:
iMoHax
2015-08-03 16:32:54 +03:00
parent cf59873bdd
commit e499d98e58
2 changed files with 7 additions and 3 deletions

View File

@@ -149,7 +149,7 @@ public class VendorsGraph extends ConnectibleGraph<Vendor> {
assert vertex.getEntry() instanceof TransitVendor && !(target.getEntry() instanceof TransitVendor);
VendorsGraphBuilder h = this;
Path<Vendor> path = new Path<>(Collections.singleton(lastEdge));
while (h != null){
while (h != null && h.edge != null){
if (callback.isCancel()) break;
BuildEdge cEdge = h.edge;
Vertex<Vendor> source = cEdge.getSource();
@@ -203,7 +203,7 @@ public class VendorsGraph extends ConnectibleGraph<Vendor> {
while (path != null){
if (callback.isCancel()) break;
VendorsGraphBuilder h = this;
while (h != null){
while (h != null && h.edge != null){
if (callback.isCancel()) break;
if (h.limit >= path.getMinFuel() && h.limit <= path.getMaxFuel()){
BuildEdge cEdge = h.edge;

View File

@@ -264,7 +264,11 @@ public class MarketAnalyzer {
}
private List<Vendor> getVendors(Place place){
return market.getVendors(place).collect(Collectors.toList());
List<Vendor> vendors = market.getVendors(place).collect(Collectors.toList());
if (vendors.isEmpty()){
vendors = Collections.singletonList(place.asTransit());
}
return vendors;
}
public MarketAnalyzer changeCallBack(AnalysisCallBack callback){