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

Safeguard against nil or empty target #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theJenix
Copy link

@theJenix theJenix commented Mar 5, 2014

Added code to safeguard against a nil or empty target string. In the case of a nil or empty target string, both commands are inhibited.

@ram-nadella
Copy link
Owner

Good catch. I see your approach and I think we can do this with fewer changes, here is how I see it, let me know what you think:

CGI.escape works fine with empty strings, it's nil that causes the error. So how about adding a line like the following in target_text() before we do the escaping

return "" if selection.nil? && current_word.nil?

Also I would prefer to skip the check before executing the command because that way the user can still launch Dash with the same commands and do a search if they want to

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.

2 participants