Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attempt matching unset fields on DateQuery #2215

Merged
merged 2 commits into from
Oct 3, 2016

Conversation

diego-plan9
Copy link
Member

On a attempt to fix #1938, it seems that the problem is actually caused by DateQuery.match being reached for an item that does not have a value set for the field to be compared? I could reproduced it by using just the types plugin:

...
types:
  foo=date

and simply:

$ beet ls foo:2000

I have added a check that returns False (basically copying the one in NumericQuery.match), and adjusted some unit tests to catch the situation. I still have not tested specifically with mpdstats, as I'm not really an user of that particular plugin, but it seems it would fix the problem?

Add a comparison at DateQuery.match in order to avoid comparing if the
field is not in the item.
Revise the existing types_plugin unit tests for explicitely checking the
behaviour when the values are unset.
@sampsyo
Copy link
Member

sampsyo commented Oct 3, 2016

Yes; this looks like exactly the cause! And your fix looks right to. Please feel free to merge (but please do add a quick note to the changelog).

@diego-plan9
Copy link
Member Author

Thanks for the quick review - merging it is, then!

@diego-plan9 diego-plan9 merged commit 36bc800 into beetbox:master Oct 3, 2016
@diego-plan9 diego-plan9 deleted the types_queries branch October 3, 2016 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mpdstats: Crash when searching by last_played field
2 participants