Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1858 from matrix-org/luke/fix-piwik-crash3
Browse files Browse the repository at this point in the history
 Fix bug that caused crash when analytics HS/IS whitelists not specified
  • Loading branch information
lukebarnard1 authored Apr 26, 2018
2 parents a17c6e1 + 5da62c6 commit 05f1ca6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class Analytics {
}

_setVisitVariable(key, value) {
if (this.disabled) return;
this._paq.push(['setCustomVariable', customVariables[key].id, key, value, 'visit']);
}

Expand All @@ -199,8 +200,8 @@ class Analytics {
const config = SdkConfig.get();
if (!config.piwik) return;

const whitelistedHSUrls = config.piwik.whitelistedHSUrls;
const whitelistedISUrls = config.piwik.whitelistedISUrls;
const whitelistedHSUrls = config.piwik.whitelistedHSUrls || [];
const whitelistedISUrls = config.piwik.whitelistedISUrls || [];

this._setVisitVariable('User Type', isGuest ? 'Guest' : 'Logged In');
this._setVisitVariable('Homeserver URL', whitelistRedact(whitelistedHSUrls, homeserverUrl));
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/MatrixChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export default React.createClass({
defaultDeviceDisplayName: this.props.defaultDeviceDisplayName,
});
}).catch((e) => {
console.error(`Error attempting to load session: ${e}`);
console.error('Error attempting to load session', e);
return false;
}).then((loadedSession) => {
if (!loadedSession) {
Expand Down

0 comments on commit 05f1ca6

Please sign in to comment.