From 1d08c1ce2ae8092157bea2e161c0df2595e21254 Mon Sep 17 00:00:00 2001 From: Florian Fetz Date: Mon, 21 Mar 2022 16:00:59 +0100 Subject: [PATCH] Fixed #38: Additions are always optionals --- asn1editor/ViewControllerFactory.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asn1editor/ViewControllerFactory.py b/asn1editor/ViewControllerFactory.py index 4d5a3a1..5939d91 100644 --- a/asn1editor/ViewControllerFactory.py +++ b/asn1editor/ViewControllerFactory.py @@ -85,7 +85,12 @@ def _sequence(self, type_: oer.Sequence, checker: constraints_checker.Dict, cont sub_controller = ControllerFactory(controller).create_container_controller(type_, optional_interface) - for sub_type in type_.root_members + ([] if type_.additions is None else type_.additions): + # Additions are always optional + additions = [] if type_.additions is None else type_.additions + for sub_type in additions: + sub_type.optional = True + + for sub_type in type_.root_members + additions: view.add_child(self.create_view_and_controller(sub_type, self.__get_member_checker(checker, sub_type.name), sub_controller)) return view