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

Crash: Undefined method '+' for nil:Nilclass #370

Open
bramski opened this issue Nov 23, 2017 · 3 comments
Open

Crash: Undefined method '+' for nil:Nilclass #370

bramski opened this issue Nov 23, 2017 · 3 comments

Comments

@bramski
Copy link

bramski commented Nov 23, 2017

NoMethodError (undefined method `+' for nil:NilClass):
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_minute.rb:48:in `offset'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/handlers.rb:431:in `handle_srp'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/handlers.rb:457:in `handle_s_r_a_s_r_p_a'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/handler.rb:76:in `invoke'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/parser.rb:254:in `block in tokens_to_span'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/parser.rb:251:in `each'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/parser.rb:251:in `tokens_to_span'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic/parser.rb:61:in `parse'
/Users/bram/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/chronic-0.10.2/lib/chronic.rb:90:in `parse'

Failing on the string "26 of November 3 to 5"

@davispuh
Copy link
Collaborator

Such format isn't supported.

@bramski
Copy link
Author

bramski commented Nov 24, 2017

This much I know. But Chronic shouldn't crash my app. It's supposed to return nil if it can't parse it.

@davispuh
Copy link
Collaborator

Yeah, that's why it's also a bug but there are a lot of inputs which could crash it, you should catch those exceptions even if Chronic would be 100% safe.

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

No branches or pull requests

2 participants