summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/mail/walk.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/leap/mail/walk.py b/src/leap/mail/walk.py
index 856daa3..30cb70a 100644
--- a/src/leap/mail/walk.py
+++ b/src/leap/mail/walk.py
@@ -151,12 +151,13 @@ def walk_msg_tree(parts, body_phash=None):
if all(x == 1 for x in pv):
# special case in the rightmost element
- main_pmap = parts[0]['part_map']
- last_part = max(main_pmap.keys())
- main_pmap[last_part]['part_map'] = {}
- for partind in range(len(pv) - 1):
- print partind+1, len(parts)
- main_pmap[last_part]['part_map'][partind] = parts[partind+1]
+ main_pmap = parts[0].get(PART_MAP, None)
+ if main_pmap is not None:
+ last_part = max(main_pmap.keys())
+ main_pmap[last_part][PART_MAP] = {}
+ for partind in range(len(pv) - 1):
+ print partind+1, len(parts)
+ main_pmap[last_part][PART_MAP][partind] = parts[partind + 1]
outer = parts[0]
outer.pop(HEADERS)