Skip to content

Commit

Permalink
Edge case defect when importing the first test node into dashboard (#763
Browse files Browse the repository at this point in the history
)
  • Loading branch information
oidebrett committed Jun 18, 2024
1 parent ffaf1f7 commit 950663f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,12 @@ async def import_test_node(self, dump: str) -> None:
else:
dump_nodes = dump_data["data"]["server"]["nodes"]
# node ids > 900000 are reserved for test nodes
next_test_node_id = max(*(x for x in self._nodes), TEST_NODE_START) + 1
if self._nodes:
next_test_node_id = max(*(x for x in self._nodes), TEST_NODE_START) + 1
else:
# an empty self._nodes dict evaluates to false so we set the first
# test node id to TEST_NODE_START
next_test_node_id = TEST_NODE_START
for node_dict in dump_nodes:
node = dataclass_from_dict(MatterNodeData, node_dict, strict=True)
node.node_id = next_test_node_id
Expand Down

0 comments on commit 950663f

Please sign in to comment.