summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2020-04-04 18:44:25 +0200
committermathieui <mathieui@mathieui.net>2020-04-04 18:44:25 +0200
commit02202f7cd8a5a3f811390796780143126fb09744 (patch)
treec21386b1fc1bc4898f3b9a008a92b08866f560bd
parent98108d0445575c2de5701accaab3afabd9f6c500 (diff)
parent2add94f5b04dbe1465c2ce83b064d381c6bdc822 (diff)
downloadslixmpp-02202f7cd8a5a3f811390796780143126fb09744.tar.gz
slixmpp-02202f7cd8a5a3f811390796780143126fb09744.tar.bz2
slixmpp-02202f7cd8a5a3f811390796780143126fb09744.tar.xz
slixmpp-02202f7cd8a5a3f811390796780143126fb09744.zip
Merge branch 'fix-nonetype-error' into 'master'
Fix an issue when deleting subelements: TypeError: 'NoneType' object is not an iterator See merge request poezio/slixmpp!39
-rw-r--r--slixmpp/xmlstream/stanzabase.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/slixmpp/xmlstream/stanzabase.py b/slixmpp/xmlstream/stanzabase.py
index c3dbfb67..f45e4b96 100644
--- a/slixmpp/xmlstream/stanzabase.py
+++ b/slixmpp/xmlstream/stanzabase.py
@@ -1031,14 +1031,19 @@ class ElementBase(object):
if not lang:
lang = default_lang
+ parent = self.xml
for level, _ in enumerate(path):
# Generate the paths to the target elements and their parent.
element_path = "/".join(path[:len(path) - level])
parent_path = "/".join(path[:len(path) - level - 1])
elements = self.xml.findall(element_path)
- parent = self.xml.find(parent_path)
-
+
+ if parent_path == '':
+ parent_path = None
+ if parent_path is not None:
+ parent = self.xml.find(parent_path)
+
if elements:
if parent is None:
parent = self.xml