Fix station selection
If current station was null, you couldn't select another station
This commit is contained in:
parent
4444b82edc
commit
9f59fc813f
@ -79,16 +79,18 @@ public class NumbersStationController implements Initializable {
|
||||
selectStationStage.setScene(new Scene(root));
|
||||
selectStationStage.show();
|
||||
selectStationStage.setOnHiding(event -> {
|
||||
selectedStationName.set((String) selectStationStage.getUserData());
|
||||
if (selectedStation != null) {
|
||||
selectedStation = settings.getStations().stream()
|
||||
.filter(station -> station.getName().equals(selectedStationName.get()))
|
||||
String newStationName = (String)selectStationStage.getUserData();
|
||||
StationSettings newSelectedStation = settings.getStations().stream()
|
||||
.filter(station -> station.getName().equals(newStationName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
if (newSelectedStation != null) {
|
||||
selectedStation = newSelectedStation;
|
||||
selectedStationName.set(newStationName);
|
||||
settings.setSelectedStationName(selectedStationName.get());
|
||||
|
||||
settings.save();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
Reference in New Issue
Block a user