From e02a22eaea1d667d40a6f65883c1552f06b0c128 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Sat, 25 Jan 2025 10:47:47 +0100 Subject: [PATCH] fix export for gpx files with no attributes --- gpx/src/io.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gpx/src/io.ts b/gpx/src/io.ts index 65c074c2..a612c917 100644 --- a/gpx/src/io.ts +++ b/gpx/src/io.ts @@ -96,7 +96,9 @@ export function buildGPX(file: GPXFile, exclude: string[]): string { }, }); - gpx.attributes.creator = gpx.attributes.creator ?? 'https://gpx.studio'; + if (!gpx.attributes) + gpx.attributes = {}; + gpx.attributes['creator'] = gpx.attributes['creator'] ?? 'https://gpx.studio'; gpx.attributes['version'] = '1.1'; gpx.attributes['xmlns'] = 'http://www.topografix.com/GPX/1/1'; gpx.attributes['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance';