Archived
0

fix null pointer exception

This commit is contained in:
iMoHax
2015-10-16 11:55:06 +03:00
parent 53fb4ea942
commit eb4667bc45
2 changed files with 9 additions and 2 deletions

View File

@@ -236,7 +236,7 @@ public class OffersController {
@Override
public void priceChange(OfferModel offer, double oldPrice, double newPrice) {
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);
}
}

View File

@@ -67,7 +67,14 @@ public class RouteSearchController {
fromStation.setItems(n.getStationNamesList());
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) -> {
toStation.setItems(n.getStationNamesList());
toStation.getSelectionModel().selectFirst();