summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-11 01:41:51 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:48 -0400
commitde762b5c6e529f4e668bee1ec848eb1f6380369b (patch)
tree0bf8ae2e536eaaa3e866bd0f9f8a324d46e9ae3b
parent080c9207c70572a02f33d50697f39878713ab6ac (diff)
catch typeerror too in empty definition
-rw-r--r--src/leap/mail/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/leap/mail/utils.py b/src/leap/mail/utils.py
index 3ba4291..fed24b3 100644
--- a/src/leap/mail/utils.py
+++ b/src/leap/mail/utils.py
@@ -49,7 +49,7 @@ def empty(thing):
thing = thing.content
try:
return len(thing) == 0
- except ReferenceError:
+ except (ReferenceError, TypeError):
return True
@@ -267,6 +267,8 @@ class CustomJsonScanner(object):
if not monkey_patched:
return self._orig_scanstring(s, idx, *args, **kwargs)
+ # TODO profile to see if a compiled regex can get us some
+ # benefit here.
found = False
end = s.find("\"", idx)
while not found: