make sure the check doesn't blow up

This commit is contained in:
Bruno Windels 2019-05-29 12:03:38 +02:00
parent ba54b16275
commit 5c8e280a45

View file

@ -22,6 +22,7 @@ limitations under the License.
*/ */
function safariVersionCheck(ua) { function safariVersionCheck(ua) {
try {
const safariVersionMatch = ua.match(/Mac OS X ([\d|_]+).*Version\/([\d|\.]+) Safari/); const safariVersionMatch = ua.match(/Mac OS X ([\d|_]+).*Version\/([\d|\.]+) Safari/);
if (safariVersionMatch) { if (safariVersionMatch) {
const macOSVersionStr = safariVersionMatch[1]; const macOSVersionStr = safariVersionMatch[1];
@ -35,6 +36,9 @@ function safariVersionCheck(ua) {
`supported: ${colrFontSupported}`); `supported: ${colrFontSupported}`);
return colrFontSupported; return colrFontSupported;
} }
} catch (err) {
console.error("Couldn't determine Safari version to check COLR font support, assuming no.", err);
}
return false; return false;
} }