Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch case, if value to update with is None #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

white-gecko
Copy link

If a node tag without timestamp is parsed a TypeError is thrown.

<node id='-25388' action='modify' visible='true' lat='1.234567' lon='9.876543' />
Traceback (most recent call last):
  File "…/.local/bin/map-machine", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "…/map-machine/map_machine/main.py", line 44, in main
    mapper.render_map(arguments)
  File "…/map-machine/map_machine/mapper.py", line 367, in render_map
    osm_data.parse_osm_file(input_file_name)
  File "…/map-machine/map_machine/osm/osm_reader.py", line 446, in parse_osm_file
    self.parse_osm(ElementTree.parse(file_name).getroot())
  File "…/map-machine/map_machine/osm/osm_reader.py", line 479, in parse_osm
    self.add_node(node)
  File "…/map-machine/map_machine/osm/osm_reader.py", line 368, in add_node
    self.time.update(node.timestamp)
  File "…/map-machine/map_machine/util.py", line 18, in update
    self.min_ = value if not self.min_ or value < self.min_ else self.min_
                                          ^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'

This pullrequest adds a check for None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant