diff --git a/gpx/src/gpx.ts b/gpx/src/gpx.ts index 426d99315..94c210603 100644 --- a/gpx/src/gpx.ts +++ b/gpx/src/gpx.ts @@ -1495,12 +1495,18 @@ export class Waypoint { this.attributes = waypoint.attributes; this.ele = waypoint.ele; this.time = waypoint.time; - this.name = waypoint.name; - this.cmt = waypoint.cmt; - this.desc = waypoint.desc; - this.link = waypoint.link; - this.sym = waypoint.sym; - this.type = waypoint.type; + this.name = waypoint.name === '' ? undefined : waypoint.name; + this.cmt = waypoint.cmt === '' ? undefined : waypoint.cmt; + this.desc = waypoint.desc === '' ? undefined : waypoint.desc; + this.link = + !waypoint.link || + !waypoint.link.attributes || + !waypoint.link.attributes.href || + waypoint.link.attributes.href === '' + ? undefined + : waypoint.link; + this.sym = waypoint.sym === '' ? undefined : waypoint.sym; + this.type = waypoint.type === '' ? undefined : waypoint.type; if (waypoint.hasOwnProperty('_data')) { this._data = waypoint._data; } diff --git a/website/src/lib/components/toolbar/tools/waypoint/Waypoint.svelte b/website/src/lib/components/toolbar/tools/waypoint/Waypoint.svelte index b804bc6de..e8887fa21 100644 --- a/website/src/lib/components/toolbar/tools/waypoint/Waypoint.svelte +++ b/website/src/lib/components/toolbar/tools/waypoint/Waypoint.svelte @@ -95,7 +95,7 @@ desc: description.length > 0 ? description : undefined, cmt: description.length > 0 ? description : undefined, link: link.length > 0 ? { attributes: { href: link } } : undefined, - sym: sym, + sym: sym.length > 0 ? sym : undefined, }, selectedWaypoint.wpt && selectedWaypoint.fileId ? new ListWaypointItem(selectedWaypoint.fileId, selectedWaypoint.wpt._data.index)