diff --git a/src/windows/title_editor.py b/src/windows/title_editor.py index 837f96e704..bb72d2961c 100644 --- a/src/windows/title_editor.py +++ b/src/windows/title_editor.py @@ -213,10 +213,11 @@ def txtLine_changed(self, txtWidget): # Update text values in the SVG for i, node in enumerate(self.tspan_nodes): - if len(node.childNodes) > 0 and i <= (len(text_list) - 1): + if i <= (len(text_list) - 1): new_text_node = self.xmldoc.createTextNode(text_list[i]) - old_text_node = node.childNodes[0] - node.removeChild(old_text_node) + if len(node.childNodes) > 0: + old_text_node = node.childNodes[0] + node.removeChild(old_text_node) # add new text node node.appendChild(new_text_node) @@ -409,8 +410,9 @@ def load_svg_template(self, filename_field=None): title_text = [] for i, node in enumerate(self.tspan_nodes): if len(node.childNodes) < 1: - continue - text = node.childNodes[0].data + text = "" + else: + text = node.childNodes[0].data title_text.append(text) # Create Label