From 43e671151c834fe7d4a836baa5e37f156d273b0b Mon Sep 17 00:00:00 2001 From: Svein Seldal Date: Tue, 21 May 2024 21:04:41 +0200 Subject: [PATCH] Fix issue with adding PDO parameter #25 --- src/objdictgen/__init__.py | 2 +- src/objdictgen/nodemanager.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/objdictgen/__init__.py b/src/objdictgen/__init__.py index 5769ee8..ef43f51 100644 --- a/src/objdictgen/__init__.py +++ b/src/objdictgen/__init__.py @@ -23,7 +23,7 @@ from objdictgen.node import Node from objdictgen.nodemanager import NodeManager -__version__ = "3.4" +__version__ = "3.5a1" # Shortcuts LoadFile = Node.LoadFile diff --git a/src/objdictgen/nodemanager.py b/src/objdictgen/nodemanager.py index 6a08076..5b81132 100644 --- a/src/objdictgen/nodemanager.py +++ b/src/objdictgen/nodemanager.py @@ -482,9 +482,13 @@ def ManageEntriesOfCurrent(self, addinglist: list[int], removinglist: list[int], node.AddEntry(index, 1, default) # Second case entry is a record else: - # FIXME: How to retrieve the number of subentries? - for i in range(1, node.GetSubentryLength(index) + 1): - subentry_infos = node.GetSubentryInfos(index, i) + i = 0 + while True: + try: + i += 1 + subentry_infos = node.GetSubentryInfos(index, i) + except ValueError: + break if "default" in subentry_infos: default = subentry_infos["default"] else: