fix null pointer exception
This commit is contained in:
@@ -236,7 +236,7 @@ public class OffersController {
|
|||||||
@Override
|
@Override
|
||||||
public void priceChange(OfferModel offer, double oldPrice, double newPrice) {
|
public void priceChange(OfferModel offer, double oldPrice, double newPrice) {
|
||||||
StationModel station = getStation();
|
StationModel station = getStation();
|
||||||
if (station.hasBuy(offer.getItem()) || station.hasSell(offer.getItem())){
|
if (station != null && (station.hasBuy(offer.getItem()) || station.hasSell(offer.getItem()))){
|
||||||
ViewUtils.doFX(OffersController.this::sort);
|
ViewUtils.doFX(OffersController.this::sort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,14 @@ public class RouteSearchController {
|
|||||||
fromStation.setItems(n.getStationNamesList());
|
fromStation.setItems(n.getStationNamesList());
|
||||||
fromStation.getSelectionModel().selectFirst();
|
fromStation.getSelectionModel().selectFirst();
|
||||||
});
|
});
|
||||||
fromStation.valueProperty().addListener((ov, o , n) -> missionsController.setStation(fromSystem.getValue().get(n)));
|
fromStation.valueProperty().addListener((ov, o , n) -> {
|
||||||
|
SystemModel system = fromSystem.getValue();
|
||||||
|
if (system == null || n == null){
|
||||||
|
missionsController.setStation(ModelFabric.NONE_STATION);
|
||||||
|
} else {
|
||||||
|
missionsController.setStation(system.get(n));
|
||||||
|
}
|
||||||
|
});
|
||||||
toSystem.valueProperty().addListener((ov, o , n) -> {
|
toSystem.valueProperty().addListener((ov, o , n) -> {
|
||||||
toStation.setItems(n.getStationNamesList());
|
toStation.setItems(n.getStationNamesList());
|
||||||
toStation.getSelectionModel().selectFirst();
|
toStation.getSelectionModel().selectFirst();
|
||||||
|
|||||||
Reference in New Issue
Block a user