fix throw exception if from place don't have stations
This commit is contained in:
@@ -149,7 +149,7 @@ public class VendorsGraph extends ConnectibleGraph<Vendor> {
|
|||||||
assert vertex.getEntry() instanceof TransitVendor && !(target.getEntry() instanceof TransitVendor);
|
assert vertex.getEntry() instanceof TransitVendor && !(target.getEntry() instanceof TransitVendor);
|
||||||
VendorsGraphBuilder h = this;
|
VendorsGraphBuilder h = this;
|
||||||
Path<Vendor> path = new Path<>(Collections.singleton(lastEdge));
|
Path<Vendor> path = new Path<>(Collections.singleton(lastEdge));
|
||||||
while (h != null){
|
while (h != null && h.edge != null){
|
||||||
if (callback.isCancel()) break;
|
if (callback.isCancel()) break;
|
||||||
BuildEdge cEdge = h.edge;
|
BuildEdge cEdge = h.edge;
|
||||||
Vertex<Vendor> source = cEdge.getSource();
|
Vertex<Vendor> source = cEdge.getSource();
|
||||||
@@ -203,7 +203,7 @@ public class VendorsGraph extends ConnectibleGraph<Vendor> {
|
|||||||
while (path != null){
|
while (path != null){
|
||||||
if (callback.isCancel()) break;
|
if (callback.isCancel()) break;
|
||||||
VendorsGraphBuilder h = this;
|
VendorsGraphBuilder h = this;
|
||||||
while (h != null){
|
while (h != null && h.edge != null){
|
||||||
if (callback.isCancel()) break;
|
if (callback.isCancel()) break;
|
||||||
if (h.limit >= path.getMinFuel() && h.limit <= path.getMaxFuel()){
|
if (h.limit >= path.getMinFuel() && h.limit <= path.getMaxFuel()){
|
||||||
BuildEdge cEdge = h.edge;
|
BuildEdge cEdge = h.edge;
|
||||||
|
|||||||
@@ -264,7 +264,11 @@ public class MarketAnalyzer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<Vendor> getVendors(Place place){
|
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){
|
public MarketAnalyzer changeCallBack(AnalysisCallBack callback){
|
||||||
|
|||||||
Reference in New Issue
Block a user