diff options
Diffstat (limited to 'slixmpp/plugins/xep_0231/stanza.py')
-rw-r--r-- | slixmpp/plugins/xep_0231/stanza.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/slixmpp/plugins/xep_0231/stanza.py b/slixmpp/plugins/xep_0231/stanza.py index 809253d4..6bde671b 100644 --- a/slixmpp/plugins/xep_0231/stanza.py +++ b/slixmpp/plugins/xep_0231/stanza.py @@ -18,10 +18,14 @@ class BitsOfBinary(ElementBase): interfaces = {'cid', 'max_age', 'type', 'data'} def get_max_age(self): - return int(self._get_attr('max-age')) + try: + return int(self._get_attr('max-age')) + except ValueError: + return None def set_max_age(self, value): - self._set_attr('max-age', str(value)) + if value is not None: + self._set_attr('max-age', str(value)) def get_data(self): return base64.b64decode(bytes(self.xml.text)) |