Fix #1124: avoid crash when deleting fields

This commit is contained in:
Adrian Sampson 2014-11-30 11:42:40 -08:00
parent fe655e4610
commit 14b150090e
2 changed files with 7 additions and 1 deletions

View file

@ -1262,7 +1262,10 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm):
for obj in objs:
obj.update(mods)
for field in dels:
del obj[field]
try:
del obj[field]
except KeyError:
pass
if ui.show_model_changes(obj):
changed.add(obj)

View file

@ -17,6 +17,9 @@ Fixed:
* We now print a better error message when the database file is corrupted.
* :doc:`/plugins/discogs`: Only prompt for authentication when running the
:ref:`import-cmd` command. :bug:`1123`
* When deleting fields with the :ref:`modify-cmd` command, do not crash when
the field cannot be removed (i.e., when it does not exist, when it is a
built-in field, or when it is a computed field). :ref:`1124`
.. _Plex: https://plex.tv/