diff --git a/DIDLLite.py b/DIDLLite.py index e5e64ab..580d0e1 100644 --- a/DIDLLite.py +++ b/DIDLLite.py @@ -252,7 +252,10 @@ class Container(Object, list): root = Object.toElement(self) - root.attrib['childCount'] = str(self.childCount) + # only include if we have children, it's possible we don't + # have our children yet, and childCount is optional. + if self.childCount: + root.attrib['childCount'] = str(self.childCount) if self.createClass is not None: SubElement(root, 'upnp:createclass').text = self.createClass