Skip to content

Commit

Permalink
Handle malformed location history
Browse files Browse the repository at this point in the history
  • Loading branch information
Stadly committed Oct 4, 2020
1 parent 2acea86 commit e0c9f54
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/LocationHistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ def Merge(LocationHistory1: ET.ElementTree, LocationHistory2: ET.ElementTree) ->

Document1 = LocationHistory1.find('ns:Document', Ns)
Document2 = LocationHistory2.find('ns:Document', Ns)
Name = Document1.find('ns:name', Ns)
Name.text += '\n' + Document2.find('ns:name', Ns).text
if Document1 is None or Document2 is None:
raise Exception('Location history is malformed.')

Name1 = Document1.find('ns:name', Ns)
Name2 = Document2.find('ns:name', Ns)
if Name1 is None or Name1.text is None or Name2 is None or Name2.text is None:
raise Exception('Location history is malformed.')

Name1.text += '\n' + Name2.text

LastPlacermark1 = Document1.find('ns:Placemark[last()]', Ns)
FirstPlacermark2 = Document2.find('ns:Placemark[1]', Ns)
Expand Down

0 comments on commit e0c9f54

Please sign in to comment.