chiark / gitweb /
Always make sure that we don't encode None
authorDaniel Martí <mvdan@mvdan.cc>
Sun, 7 Jun 2015 12:02:50 +0000 (14:02 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 7 Jun 2015 12:02:50 +0000 (14:02 +0200)
Apparently, we can have a non-nil element that has a nil text.

fdroidserver/common.py

index c2eb4388d93617ee3058fd4a3fc40b41bf1ff2c4..f031b1939c250ef4893f96ca639c5d20bb8fb529 100644 (file)
@@ -888,7 +888,7 @@ def retrieve_string(app_dir, string, xmlfiles=None):
             continue
         xml = parse_xml(path)
         element = xml.find('string[@name="' + name + '"]')
-        if element is not None:
+        if element is not None and element.text is not None:
             return retrieve_string(app_dir, element.text.encode('utf-8'), xmlfiles)
 
     return ''