diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java index a2280d05f..b3553d70f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java @@ -46,7 +46,14 @@ public class SortDiagramStation { private Station findNotDepotStation(boolean isRight, int index) { - Station station = stationList.get(index); + Station station = null; + if (index >= stationList.size()) { + station = stationList.get(stationList.size() - 1); + } else if (index <= 0) { + station = stationList.get(0); + } else { + station = stationList.get(index); + } while (station.isDepot()) { index += isRight ? -1 : 1; station = stationList.get(index);