Skip to content

Commit eb4ac9e

Browse files
author
Michael Laktionov
committed
validate navigator exists
1 parent c97eb88 commit eb4ac9e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/components/helpers/get-ua-data.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const mockUserAgent = userAgent => {
1717
export const setDefaults = (p, d = "none") => (p ? p : d);
1818

1919
export const isIOS13Check = type => {
20-
return (
20+
return navigator && (
2121
navigator.platform.includes(type) ||
2222
(navigator.platform === "MacIntel" &&
2323
navigator.maxTouchPoints > 1 &&

src/components/helpers/selectors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ const isIEType = () =>
4343
browser.name === BROWSER_TYPES.INTERNET_EXPLORER ||
4444
browser.name === BROWSER_TYPES.IE;
4545
const isElectronType = () => {
46-
const ua = navigator.userAgent.toLowerCase()
46+
const ua = navigator && navigator.userAgent.toLowerCase()
4747

48-
return ua.includes('electron')
48+
return typeof ua === 'string' ? ua.includes('electron') : false
4949
}
5050

5151
const getIOS13 = () => {
52-
return (
52+
return navigator && (
5353
(/iPad|iPhone|iPod/.test(navigator.platform) ||
5454
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1)) &&
5555
!window.MSStream

0 commit comments

Comments
 (0)