Skip to content

Commit

Permalink
Merge pull request #11 from Ausdach/check_if_node_supports_children
Browse files Browse the repository at this point in the history
Check if the parent node can have children before getting or adding children
  • Loading branch information
girishchandranc committed Jul 13, 2023
2 parents c85e6f7 + a4c3049 commit 559010e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Support for processing the integer attributes configured as hex, binary or octal
- Fixed issue with elements not being added to set when the element has no short name(eg: DATA-TYPE-MAP)
- Added splittable support
- Now, `autosarfactory` can read list of folders and can deep search for the arxml files.

## [0.3.1]() - 2023-07-11
- Check if the parent node can have children before getting or adding children
9 changes: 5 additions & 4 deletions autosarfactory/autosar_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ def __populate_tree(self, autosar_root):


def __add_child(self, node, parentItem, idCounter):
for child in node.get_children():
childTree = self.__create_tree_item(child, parentItem, idCounter)
# add child nodes
self.__add_child(child, childTree, idCounter)
if hasattr(node, 'get_children') and callable(getattr(node, 'get_children')):
for child in node.get_children():
childTree = self.__create_tree_item(child, parentItem, idCounter)
# add child nodes
self.__add_child(child, childTree, idCounter)


def __create_tree_item(self, node, parentItem, idCounter):
Expand Down
3 changes: 2 additions & 1 deletion autosarfactory/autosarfactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def __merge_to_parent_node(node, parentNode):
"""
nodeWithSamePath = list(filter(lambda n: n == node, parentNode.get_children()))
if nodeWithSamePath is None or len(nodeWithSamePath) == 0:
parentNode.add_child(node)
if hasattr(node, 'add_child') and callable(getattr(node, 'add_child')):
parentNode.add_child(node)
else:
if nodeWithSamePath[0].is_atp_splitable():
#ignore if value variation points
Expand Down

0 comments on commit 559010e

Please sign in to comment.