mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
Merge pull request #2721 from balena-io/fix-getMixpanelConfig
Fix error when config.analytics was undefined
This commit is contained in:
commit
ff3982efa4
@ -71,11 +71,13 @@ function getConfig(url) {
|
||||
*/
|
||||
// eslint-disable-next-line
|
||||
function getMixpanelConfig(config) {
|
||||
const probability = config.analytics.mixpanel.probability || DEFAULT_PROBABILITY
|
||||
const analytics = config.analytics || {}
|
||||
const mixpanel = analytics.mixpanel || {}
|
||||
const probability = mixpanel.probability || DEFAULT_PROBABILITY
|
||||
if (Math.random() > probability) {
|
||||
return null
|
||||
}
|
||||
return validateMixpanelConfig(config.analytics.mixpanel)
|
||||
return validateMixpanelConfig(mixpanel)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user