diff --git a/src/main/java/ch/hepia/ui/MainWindowController.java b/src/main/java/ch/hepia/ui/MainWindowController.java index c15100e53bda3f98b0d22e56bbf67cded057a423..843c2d3c2e826d7db87a0be6f31662f4bfbf03ea 100644 --- a/src/main/java/ch/hepia/ui/MainWindowController.java +++ b/src/main/java/ch/hepia/ui/MainWindowController.java @@ -283,8 +283,10 @@ public class MainWindowController implements Initializable { Integer pos = Integer.parseInt(pnl.getId()); WeatherAPI api = new WeatherAPI(); Connection connection = displayedConnections.get(pos); + System.out.println(connection.getTo().getLocation().getCoordinates()); + if (!(currentJourney instanceof Connection.EmptyConnection)){ - leaveJourney(app, api.getWeatherFrom(connection.getTo().toString()).getConditions()); + leaveJourney(app, api.getWeatherFrom(connection.getTo().getLocation().getCoordinates()).getConditions()); } String weather = api.getWeatherFrom(connection.getTo().toString()).getConditions(); @@ -307,7 +309,7 @@ public class MainWindowController implements Initializable { Optional<ButtonType> result = alert.showAndWait(); if (result.get().equals(oui)){ try { - leaveJourney(app, api.getWeatherFrom(connection.getTo().toString()).getConditions()); + leaveJourney(app, api.getWeatherFrom(connection.getTo().getLocation().getCoordinates()).getConditions()); } catch (IOException e) { showSadMessage(AppConfig.ERROR_API_MQ); e.printStackTrace();