nil user-agent string causes raise in 1.1.0
jrochkind opened this issue · 2 comments
jrochkind commented
In device_detector 1.0.7
DeviceDector.new(nil).device_name # => nil
In device_detector 1.1.0
DeviceDector.new(nil).device_name
raises
gems/device_detector-1.1.0/lib/device_detector.rb:221:in
fix_for_x_music': undefined method
include?' for nil:NilClass (NoMethodError)
This seems like maybe an unintended backwards incompatible change, that may break some dependents that aren't prepared for it?
The easy workaround seems to be to make sure you never pass nil
to DeviceDector.new
; passing an empty string is fine, so DeviceDector.new(str_var || "")
might be the way to go.
But perhaps DeviceDetector should handle this itself?
melcher commented
Ran into the same issue when trying to upgrade.
jrochkind commented
Thanks @girardof and @spiderpug !
I wonder if a CI test for nil user-agent would be in order to prevent regression?