Skip to content

Commit

Permalink
Avoid crashes on empty result sets in as_text()
Browse files Browse the repository at this point in the history
  • Loading branch information
BjarniRunar committed Jan 3, 2014
1 parent 5cea729 commit c5a7a99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mailpile/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def as_text(self):
text = []
count = self['stats']['start']
expand_ids = [e.msg_idx_pos for e in (self.emails or [])]
addresses = self['data']['addresses']
addresses = self.get('data', {}).get('addresses', {})
for mid in self['thread_ids']:
if mid in self['data'].get('message', {}):
exp_email = self.emails[expand_ids.index(int(mid, 36))]
Expand All @@ -523,7 +523,7 @@ def as_text(self):
46 - (clen + len(msg_tags)))
text.append((cfmt + ' %s%-22.22s ' + sfmt + '%7s'
) % (count, tag_new and '*' or ' ',
addresses[m['from_aid']]['fn'],
addresses.get(m['from_aid'], {}).get('fn'),
m['subject'], msg_tags,
elapsed_datetime(m['timestamp'])))
count += 1
Expand Down

0 comments on commit c5a7a99

Please sign in to comment.