missing: tolerate disctotal == None

This problem:
http://pastebin.ca/2466454
is likely indicative of a bug elsewhere, but defensive coding seems like a
good idea here.
This commit is contained in:
Adrian Sampson 2013-10-13 18:22:43 -07:00
parent ce7254c08a
commit fac13a041e
2 changed files with 5 additions and 1 deletions

View file

@ -28,7 +28,7 @@ log = logging.getLogger('beets')
def _missing_count(album):
"""Return number of missing items in `album`.
"""
return album.tracktotal - len([i for i in album.items()])
return (album.tracktotal or 0) - len(album.items())
def _missing(album):

View file

@ -4,6 +4,10 @@ Changelog
1.3.2 (in development)
----------------------
Little fixes:
* :doc:`/plugins/missing`: Avoid a possible error when an album's
``tracktotal`` field is missing.
1.3.1 (October 12, 2013)
------------------------