fix:因为null导致无法leg状态回写

This commit is contained in:
lulz1 2024-07-03 14:21:05 +08:00
parent beb7219f30
commit c1672a59a9
1 changed files with 5 additions and 5 deletions

View File

@ -436,11 +436,11 @@ public class Leg implements Serializable, EventManageable {
public Leg restoreFromLegString(String legString) { public Leg restoreFromLegString(String legString) {
String[] parts = legString.split("\\|"); String[] parts = legString.split("\\|");
if (parts.length == 5) { if (parts.length == 5) {
this.startTime = DateTimeUtil.strToTime(parts[0]); this.startTime = parts[0] != null ? DateTimeUtil.strToTime(parts[0]) : null;
this.endTime = DateTimeUtil.strToTime(parts[1]); this.endTime = parts[1] != null ? DateTimeUtil.strToTime(parts[1]) : null;
this.originId = Long.parseLong(parts[2]); this.originId = parts[2] != null ? Long.parseLong(parts[2]) : null;
this.destinationId = Long.parseLong(parts[3]); this.destinationId = parts[3] != null ? Long.parseLong(parts[3]) : null;
this.estimateAmount = parts[4]; this.estimateAmount = parts[4] != null ? parts[4] : null;
} else { } else {
throw new IllegalArgumentException("Invalid legString format."); throw new IllegalArgumentException("Invalid legString format.");
} }