Skip to content

Commit

Permalink
Fix #700 - Error on getOS() when userAgentData.platform is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed May 28, 2024
1 parent e7bfc4e commit 3bfd164
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
_os[NAME] = undefined;
_os[VERSION] = undefined;
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
.replace(/chrome os/i, CHROMIUM_OS)
.replace(/macos/i, MAC_OS); // backward compatibility
Expand Down

0 comments on commit 3bfd164

Please sign in to comment.