Permalink
Browse files

Time.parse("") blows up on ruby 1.9

>> RUBY_DESCRIPTION
=> "ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.4.0]"
>> require 'time'
=> true
>> Time.parse('')
ArgumentError: no time information in ""
    from .rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/time.rb:267:in `parse'
  • Loading branch information...
1 parent e1f89af commit cc4ef394311fc059741506c93c5158c3973bbc43 @tmm1 tmm1 committed Aug 9, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/multipass.rb
View
@@ -84,11 +84,11 @@ def decode(data)
# Force everything coming out of json into a Time object if it isn't already
# with YAJL, it parses dates for us (ugh)
- if options.has_key?(:expires) && options[:expires].is_a?(String)
+ if options.has_key?(:expires) && options[:expires].is_a?(String) && !options[:expires].empty?
options[:expires] = Time.parse(options[:expires])
end
- if options[:expires].nil? || Time.now.utc > options[:expires]
+ if options[:expires].nil? || (options[:expires] != '' && Time.now.utc > options[:expires])
raise MultiPass::ExpiredError.new(data, json, options)
end

0 comments on commit cc4ef39

Please sign in to comment.