pazz/alot — Issue #346: alot crash when displaying search result with empty subject
Author: teythoon
Created: 2012-02-21 10:12:56+00:00
State: open
Labels: <15mins, bug

I can reproduce this easily with

```
teythoon@thinkbox ~ % echo test | mail `whoami` -s ''
teythoon@thinkbox ~ % notmuch new
Processed 1 file in almost no time.
Added 1 new message to the database.
teythoon@thinkbox ~ % alot search tag:new

Traceback (most recent call last):
File "/home/teythoon/.local/bin/alot", line 20, in
main()
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/init.py", line 187, in main
args['colour-mode'],
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/ui.py", line 108, in __init__
self.mainloop.run()
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 274, in run
self.screen.run_wrapper(self._run)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/raw_display.py", line 229, in run_wrapper
return fn()
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 285, in _run
self.draw_screen()
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/main_loop.py", line 508, in draw_screen
canvas = self._topmost_widget.render(self.screen_size, focus=True)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/widget.py", line 132, in cached_render
canv = fn(self, size, focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/widget.py", line 1318, in render
canv = get_delegate(self).render(size, focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/widget.py", line 132, in cached_render
canv = fn(self, size, focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/container.py", line 596, in render
focus and self.focus_part == 'body')
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/buffers.py", line 25, in render
return self.body.render(size, focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/widget.py", line 132, in cached_render
canv = fn(self, size, focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/listbox.py", line 327, in render
(maxcol, maxrow), focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/listbox.py", line 215, in calculate_visible
self._set_focus_complete( (maxcol, maxrow), focus )
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/listbox.py", line 494, in _set_focus_complete
(maxcol,maxrow), focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/listbox.py", line 464, in _set_focus_first_selectable
(maxcol, maxrow), focus=focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/urwid-1.0.0-py2.7-linux-x86_64.egg/urwid/listbox.py", line 218, in calculate_visible
focus_widget, focus_pos = self.body.get_focus()
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/walker.py", line 21, in get_focus
return self._get_at_pos(self.focus)
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/walker.py", line 50, in _get_at_pos
widget = self._get_next_item()
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/walker.py", line 63, in _get_next_item
next_widget = self.containerclass(next_obj, **self.kwargs)
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/widgets.py", line 83, in __init__
self.rebuild()
File "/home/teythoon/.local/lib/python2.7/site-packages/alot/widgets.py", line 135, in rebuild
subjectstring = self.thread.get_subject().strip()
AttributeError: 'NoneType' object has no attribute 'strip'
```