# HG changeset patch # User Goffi # Date 1562829670 -7200 # Node ID 5ecce65631a2b9701c29c698ba88686021c2ba50 # Parent 94708a7d3ecfb794b0bbaf2b1d78509b7d5489c3 frontends (xmlui): fixed crash when CURRENT_LABEL is None: fix 323 diff -r 94708a7d3ecf -r 5ecce65631a2 sat_frontends/tools/xmlui.py --- a/sat_frontends/tools/xmlui.py Tue Jul 09 09:06:45 2019 +0200 +++ b/sat_frontends/tools/xmlui.py Thu Jul 11 09:21:10 2019 +0200 @@ -466,6 +466,10 @@ elif type_ == "label": cont = self.widget_factory.createLabelContainer(_xmlui_parent) self._parseChilds( + # FIXME: the "None" value for CURRENT_LABEL doesn't seem + # used or even useful, it should probably be removed + # and all "is not None" tests for it should be removed too + # to be checked for 0.8 cont, node, ("widget", "container"), {CURRENT_LABEL: None} ) elif type_ == "advanced_list": @@ -541,8 +545,10 @@ ): # current widget is ignored, but there may be already a label if CURRENT_LABEL in data: - # if so, we remove it from parent - _xmlui_parent._xmluiRemove(data.pop(CURRENT_LABEL)) + curr_label = data.pop(CURRENT_LABEL) + if curr_label is not None: + # if so, we remove it from parent + _xmlui_parent._xmluiRemove(curr_label) continue type_ = node.getAttribute("type") value_elt = self._getChildNode(node, "value") @@ -689,9 +695,11 @@ ctrl._xmlui_name = name _xmlui_parent._xmluiAppend(ctrl) if CURRENT_LABEL in data and not isinstance(ctrl, LabelWidget): - # this key is set in LabelContainer, when present - # we can associate the label with the widget it is labelling - data.pop(CURRENT_LABEL)._xmlui_for_name = name + curr_label = data.pop(CURRENT_LABEL) + if curr_label is not None: + # this key is set in LabelContainer, when present + # we can associate the label with the widget it is labelling + curr_label._xmlui_for_name = name else: raise NotImplementedError(_("Unknown tag [%s]") % node.nodeName)