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

Don't crash when no argument is given #1207

Merged
merged 1 commit into from
Jan 6, 2015
Merged

Conversation

brunal
Copy link
Contributor

@brunal brunal commented Jan 6, 2015

Check that there is a sub-argument before getting the first one. Fixes issue #1205

@sampsyo
Copy link
Member

sampsyo commented Jan 6, 2015

Dang, do I feel dumb now.

sampsyo added a commit that referenced this pull request Jan 6, 2015
Don't crash when no argument is given
@sampsyo sampsyo merged commit 5add272 into beetbox:master Jan 6, 2015
sampsyo added a commit that referenced this pull request Jan 6, 2015
@@ -924,7 +924,8 @@ def _raw_main(args, lib=None):
# Special case for the `config --edit` command: bypass _setup so
# that an invalid configuration does not prevent the editor from
# starting.
if subargs[0] == 'config' and ('-e' in subargs or '--edit' in subargs):
if subargs and subargs[0] == 'config' \
and ('-e' in subargs or '--edit' in subargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the indentation off by one? Eh. I guess flake8 didn't complain so it's probably all good. Just seemed odd to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I guess it just follows the identation of "subargs". Right. I'm too tired to look at code right now. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I guess it's visually aligned with the start of the expression on the previous line. In any case, feel free to fiddle with it using your newfound commit powers. 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's right! How would you prefer it to be? That's what pep8 prefers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good actually! It's just a bit funny because it's 3 spaces, which is almost 4 spaces. Let's leave it.

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.

3 participants