1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Dirty fix for infinite loop

Changed back `continue wpoints_loop` to `break wpoints_loop` because it causes an infinite loop once `wpt_i` reaches `wpoints.length` and `wpoints[wpt_i]` is undefined , yet it continues to loop for some reason. Break is not nice because there could be defined values for bigger wpt_i 
Attempt to understand why with `console.log(wpoints.length)`.
This commit is contained in:
zigmhount 2022-03-11 23:01:28 +01:00 committed by GitHub
parent 92f346b1ca
commit bc7ffb39b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -396,9 +396,10 @@ export class GalleryMapLightboxComponent implements OnChanges {
this.mapLayersControlOption.overlays.Paths.addLayer(polyline(path as LatLng[]));
}
if (wpoints.length !== 0) {
console.log("wpoints.length=" + wpoints.length);
wpoints_loop: for (let wpt_i = 0; i < wpoints.length; wpt_i++) {
if (wpoints[wpt_i] === undefined) {
continue wpoints_loop;
break wpoints_loop;
}
this.mapLayersControlOption.overlays.Paths.addLayer(marker(wpoints[wpt_i] as LatLng));
}