Fix #700 - Error on getOS() when userAgentData.platform is undefined

This commit is contained in:
Faisal Salman 2024-05-28 20:44:52 +07:00
parent e7bfc4e28d
commit 3bfd164aa5

View File

@ -872,7 +872,7 @@
_os[NAME] = undefined; _os[NAME] = undefined;
_os[VERSION] = undefined; _os[VERSION] = undefined;
rgxMapper.call(_os, _ua, _rgxmap.os); rgxMapper.call(_os, _ua, _rgxmap.os);
if (_isSelfNav && !_os[NAME] && _uach && _uach.platform != 'Unknown') { if (_isSelfNav && !_os[NAME] && _uach && _uach.platform && _uach.platform != 'Unknown') {
_os[NAME] = _uach.platform _os[NAME] = _uach.platform
.replace(/chrome os/i, CHROMIUM_OS) .replace(/chrome os/i, CHROMIUM_OS)
.replace(/macos/i, MAC_OS); // backward compatibility .replace(/macos/i, MAC_OS); // backward compatibility