mapbox / mapbox/leaflet-omnivore

Uncaught TypeError when loading trkseg with only one trkpt

Open
#115 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
680
Forks
128
PR merge metrics
No merged PRs in 30d

Description

```
leaflet-omnivore.js:1019 Uncaught TypeError: Cannot read property 'line' of undefined
at getTrack (leaflet-omnivore.js:1019)
at Object.gpx (leaflet-omnivore.js:991)
at gpxParse (leaflet-omnivore.js:213)
at XMLHttpRequest.onload (leaflet-omnivore.js:114)
at XMLHttpRequest.loaded (leaflet-omnivore.js:395)
```
after omnivore.gpx("x.gpx")

The file contains a _trkseq_ with only only one _trkpnt_. Unfortunately this problem stops reading all other segments too.

```

Name

a


628.00



627.50





626.50





626.00



626.50


```

Contributor guide

Open the contributing guide

Research direction

Start in leaflet-omnivore.js at getTrack around line 1019, called through gpx. Reproduce with the supplied GPX containing a single-point track segment and verify how later segments are handled. Done means loading the file no longer throws an uncaught TypeError and the remaining segments are still parsed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.