fixed index out of array after deleting FlightPath for map

This commit is contained in:
YaFedImYaEatIm
2016-09-19 15:00:09 +12:00
parent ddac466879
commit 73cfca0ccc
2 changed files with 3 additions and 2 deletions
BIN
View File
Binary file not shown.
@@ -117,8 +117,9 @@ public class FlightSummaryController extends Controller {
}
flightPathListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
if(newValue.equals(Worker.State.SUCCEEDED)) {
map.displayRoute(theDataSet.getFlightPaths().get(flightPathListView.getSelectionModel().getSelectedIndices().get(0)).getRoutePath());
int index = flightPathListView.getSelectionModel().getSelectedIndices().get(0);
if (index != -1) {
map.displayRoute(theDataSet.getFlightPaths().get(index).getRoutePath());
}
}
});