From 5bba9574dd0a8906178a928e4b7e8f1877a75a12 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 11 Feb 2014 01:41:51 -0400 Subject: catch typeerror too in empty definition --- mail/src/leap/mail/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mail/src/leap/mail/utils.py b/mail/src/leap/mail/utils.py index 3ba42917..fed24b39 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: -- cgit v1.2.3