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.setScene(new Scene(root));
|
||||||
selectStationStage.show();
|
selectStationStage.show();
|
||||||
selectStationStage.setOnHiding(event -> {
|
selectStationStage.setOnHiding(event -> {
|
||||||
selectedStationName.set((String) selectStationStage.getUserData());
|
String newStationName = (String)selectStationStage.getUserData();
|
||||||
if (selectedStation != null) {
|
StationSettings newSelectedStation = settings.getStations().stream()
|
||||||
selectedStation = settings.getStations().stream()
|
.filter(station -> station.getName().equals(newStationName))
|
||||||
.filter(station -> station.getName().equals(selectedStationName.get()))
|
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
if (newSelectedStation != null) {
|
||||||
|
selectedStation = newSelectedStation;
|
||||||
|
selectedStationName.set(newStationName);
|
||||||
settings.setSelectedStationName(selectedStationName.get());
|
settings.setSelectedStationName(selectedStationName.get());
|
||||||
|
|
||||||
settings.save();
|
settings.save();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
Reference in New Issue
Block a user