jonathantneal/svg4everybody

`navigator.userAgent` is expected to be a string

nirazul opened this issue · 0 comments

I've run into some error reports that I could trace back to these lines of code.

The problem is, that navigator.userAgent is expected to be a string. Some browsers behave differently and allow the user to completely suppress sending a userAgent property at all.

An easy fix would be to set a default value like this:

const ua = navigator.userAgent || '';
ua.match(olderEdgeUA); // <-- this is safe now

I could prepare a PR, if you're ok with the changes.