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
commit5bba9574dd0a8906178a928e4b7e8f1877a75a12 (patch)
treeada78c16c2e867028ddf7f390d14a786a1fa547f
parent630798ef91504b5d01ba7f673532a5875ba8c9a8 (diff)
catch typeerror too in empty definition
-rw-r--r--mail/src/leap/mail/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mail/src/leap/mail/utils.py b/mail/src/leap/mail/utils.py
index 3ba4291..fed24b3 100644
--- a/mail/src/leap/mail/utils.py
+++ b/mail/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: