ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

error when trying to determine version for checking whether to useCssLoadPatch #416

Open nbrustein opened 6 years ago

nbrustein commented 6 years ago

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:

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.

booleanbetrayal commented 6 years ago

@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