Skip to content

Commit

Permalink
fix NoneType issue
Browse files Browse the repository at this point in the history
  • Loading branch information
joergbuchwald committed Jul 23, 2024
1 parent c272c86 commit 79203f0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ogs6py/ogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ def _remove_empty_elements(self):
empty_el_list = ["./time_loop/global_process_coupling", "./curves"]
for element in empty_text_list:
entry = root.find(element)
if entry.text == "":
self.remove_element(element)
if entry is not None:
self.remove_element(".", tag=entry.tag, text="")
for element in empty_el_list:
entry = root.find(element)
if len(entry.getchildren()) == 0:
self.remove_element(element)
if entry is not None:
if len(entry.getchildren()) == 0:
entry.getparent().remove(entry)

@classmethod
def _get_parameter_pointer(cls, root, name, xpath):
Expand Down

0 comments on commit 79203f0

Please sign in to comment.