From d6ca1cc2423174140166dec6ecf5b799acdde4a0 Mon Sep 17 00:00:00 2001 From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> Date: Tue, 15 Jun 2021 11:41:13 +0200 Subject: [PATCH 1/2] duplicates: fix crash when query return empty results --- beetsplug/duplicates.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beetsplug/duplicates.py b/beetsplug/duplicates.py index bc9e3ff3c..d608ddd4b 100644 --- a/beetsplug/duplicates.py +++ b/beetsplug/duplicates.py @@ -136,6 +136,11 @@ class DuplicatesPlugin(BeetsPlugin): keys = ['mb_trackid', 'mb_albumid'] items = lib.items(decargs(args)) + # If there's nothing to do, return early. The code below assumes + # `items` to be non-empty. + if not items: + return + if path: fmt = u'$path' From 0e1c102337b36f8788a4bcc70e329d3604e95443 Mon Sep 17 00:00:00 2001 From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com> Date: Tue, 15 Jun 2021 11:44:06 +0200 Subject: [PATCH 2/2] duplicates: update changelog --- docs/changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 5ca9a8f9c..dcfcda98c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -383,6 +383,9 @@ Fixes: * :doc:`/plugins/lyrics`: Fix crashes when a website could not be retrieved, affecting at least the Genius source :bug:`3970` +* :doc:`/plugins/duplicates`: Fix a crash when running the ``dup`` command with + a query that returns no results. + :bug:`3943` For plugin developers: