ocLazyLoad icon indicating copy to clipboard operation
ocLazyLoad copied to clipboard

error when trying to determine version for checking whether to useCssLoadPatch

Open nbrustein opened this issue 8 years ago • 1 comments

In the wild, on line 913 of ocLazyLoad.js, a few of our users hit the following error:

null is not an object (evaluating 'v[1]')

The relevant line of code is:

var iOSVersion = parseFloat([parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)].join('.'));

We've seen this with the following user agents:

  • Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/604.4.7 (KHTML, like Gecko) Version/10.0 Safari/602.1.31
  • Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12

It seems like window.navigator.platform is reporting that this device is an iOS device, but window.navigator.appVersion is not in the expected format.

nbrustein avatar Feb 05 '18 16:02 nbrustein

@ocombe / @nbrustein - Made a quick inline-PR to handle a fall-through scenario for when user-agent strings + platform combinations are unknown. https://github.com/ocombe/ocLazyLoad/pull/417

booleanbetrayal avatar Feb 05 '18 17:02 booleanbetrayal