Skip to content

Commit

Permalink
Fix #1124: avoid crash when deleting fields
Browse files Browse the repository at this point in the history
  • Loading branch information
sampsyo committed Nov 30, 2014
1 parent fe655e4 commit 14b1500
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion beets/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down

0 comments on commit 14b1500

Please sign in to comment.