Fix station selection

If current station was null, you couldn't select another station
This commit is contained in:
Nathan McRae 2025-01-10 21:43:35 -08:00
parent 4444b82edc
commit 9f59fc813f

View File

@ -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();