Commits

Adrian Sampson committed c26e020

zero: fix nulling fields containing None

Comments (0)

Files changed (2)

beetsplug/zero.py

                     continue
                 self._log.debug(u'[zero] \"{0}\" ({1}) match: {2}'
                                 .format(fval, fn, ' '.join(patterns)))
-                setattr(item, fn, type(fval)())
+                new_val = None if fval is None else type(fval)()
+                setattr(item, fn, new_val)
                 self._log.debug(u'[zero] {0}={1}'
                                 .format(fn, getattr(item, fn)))

docs/changelog.rst

   that go missing.
 * The :ref:`modify-cmd` command can now change albums' album art paths (i.e.,
   ``beet modify artpath=...`` works). Thanks to Lucas Duailibe.
+* :doc:`/plugins/zero`: Fix a crash when nulling out a field that contains
+  None.
 * Various UI enhancements to the importer due to Tai Lee:
 
   * More consistent format and colorization of album and track metadata.