From 71175a9b60ab9b337e9ab98d7f30ab8bcd28fa36 Mon Sep 17 00:00:00 2001 From: Alexander Mitzkus Date: Sun, 10 Mar 2024 20:30:09 +0100 Subject: [PATCH] Fixed: Importing nameless routes as untitled instead of crash --- gpx_blender/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gpx_blender/__init__.py b/gpx_blender/__init__.py index 2fb3c8f..8c8730e 100644 --- a/gpx_blender/__init__.py +++ b/gpx_blender/__init__.py @@ -16,7 +16,7 @@ "author" : "zuggamasta", "description" : "", "blender" : (4, 0, 2), - "version" : (0, 1, 1), + "version" : (0, 1, 2), "location" : "", "tracker_url": "https://github.com/zuggamasta/GPX-Importer/issues", "warning" : "", @@ -65,7 +65,13 @@ def read_gpx_data(context, filepath, use_create_edges, plot_elevation): xml = parse(filepath) trkpts = xml.getElementsByTagName("trkpt") - routename = xml.getElementsByTagName("name")[0].firstChild.nodeValue + + try: + routename = xml.getElementsByTagName("name")[0].firstChild.nodeValue + except: + print("No route name found.") + + routename = "untitled route" try: print("Importing: " + routename + " ...",end=' ')