From 8049bd6530f7ab7fefcabc003e271892bcc8d913 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/nodemanager.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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: