mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-26 15:06:42 +01:00
Fix crash on invalid schedule regex (e.g. "station \\E1\\Q")
This commit is contained in:
parent
aff05bf84a
commit
30a90a6203
1 changed files with 11 additions and 7 deletions
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
|
||||||
import com.simibubi.create.AllItems;
|
import com.simibubi.create.AllItems;
|
||||||
import com.simibubi.create.content.trains.display.GlobalTrainDisplayData.TrainDeparturePrediction;
|
import com.simibubi.create.content.trains.display.GlobalTrainDisplayData.TrainDeparturePrediction;
|
||||||
|
@ -184,12 +185,15 @@ public class ScheduleRuntime {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
for (GlobalStation globalStation : train.graph.getPoints(EdgePointType.STATION)) {
|
for (GlobalStation globalStation : train.graph.getPoints(EdgePointType.STATION)) {
|
||||||
if (!globalStation.name.matches(regex))
|
if (!globalStation.name.matches(regex))
|
||||||
continue;
|
continue;
|
||||||
anyMatch = true;
|
anyMatch = true;
|
||||||
validStations.add(globalStation);
|
validStations.add(globalStation);
|
||||||
}
|
}
|
||||||
|
} catch (PatternSyntaxException ignored) {}
|
||||||
|
|
||||||
DiscoveredPath best = train.navigation.findPathTo(validStations, Double.MAX_VALUE);
|
DiscoveredPath best = train.navigation.findPathTo(validStations, Double.MAX_VALUE);
|
||||||
if (best == null) {
|
if (best == null) {
|
||||||
if (anyMatch)
|
if (anyMatch)
|
||||||
|
|
Loading…
Reference in a new issue