Skip to content

Commit 6e14eac

Browse files
fix: check for valid start and end waypoints on vehicles before writing to model (#200)
1 parent 582b6cc commit 6e14eac

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

application/frontend/src/app/core/containers/csv-upload-dialog/csv-upload-dialog.component.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,16 +1143,22 @@ export class CsvUploadDialogComponent implements OnDestroy, OnInit {
11431143

11441144
geocodingResultsToVehicles(res: any): void {
11451145
for (let i = 0; i < res.length; i += 2) {
1146-
this.scenario.model.vehicles[i / 2].startWaypoint = {
1147-
location: {
1148-
latLng: res[i],
1149-
},
1150-
};
1151-
this.scenario.model.vehicles[i / 2].endWaypoint = {
1152-
location: {
1153-
latLng: res[i + 1],
1154-
},
1155-
};
1146+
const start = res[i];
1147+
const end = res[i + 1];
1148+
if (start) {
1149+
this.scenario.model.vehicles[i / 2].startWaypoint = {
1150+
location: {
1151+
latLng: res[i],
1152+
},
1153+
};
1154+
}
1155+
if (end) {
1156+
this.scenario.model.vehicles[i / 2].endWaypoint = {
1157+
location: {
1158+
latLng: res[i + 1],
1159+
},
1160+
};
1161+
}
11561162
}
11571163
}
11581164

0 commit comments

Comments
 (0)