Crash when "defaults" not specified in config #9

Closed
sampsyo opened this Issue Nov 16, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@sampsyo
Contributor

sampsyo commented Nov 16, 2011

If the user doesn't have a "defaults" dict in config.yaml, the defaults field on the Config object is None because this method returns None implicitly: https://github.com/ghickman/tvrenamr/blob/master/tvrenamr/config.py#L96

Then, later, when a config value is looked up, defaults is assumed to exist: https://github.com/ghickman/tvrenamr/blob/master/tvrenamr/config.py#L27

This raises a "TypeError: 'NoneType' object is not subscriptable" error, which is not handled. You probably want this somewhere in there:

if not self.defaults:
     return False
@ghickman

This comment has been minimized.

Show comment
Hide comment
@ghickman

ghickman Nov 16, 2011

Owner

@sampsyo thanks for reporting this and #8. I'll push a fix for this tonight but it's made me realise that I need to make the config module cope with no defaults in a more sane way.

Owner

ghickman commented Nov 16, 2011

@sampsyo thanks for reporting this and #8. I'll push a fix for this tonight but it's made me realise that I need to make the config module cope with no defaults in a more sane way.

@sampsyo

This comment has been minimized.

Show comment
Hide comment
@sampsyo

sampsyo Nov 16, 2011

Contributor

Cool! That makes sense. And thanks for all your work on this project; it's definitely the most straightforward implementation in the "TV episode rename" category that I've seen so far. :)

Contributor

sampsyo commented Nov 16, 2011

Cool! That makes sense. And thanks for all your work on this project; it's definitely the most straightforward implementation in the "TV episode rename" category that I've seen so far. :)

@ghickman ghickman closed this in c84ede4 Nov 16, 2011

@ghickman

This comment has been minimized.

Show comment
Hide comment
@ghickman

ghickman Nov 16, 2011

Owner

I've released to the PyPI too =)

Owner

ghickman commented Nov 16, 2011

I've released to the PyPI too =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment