Skip to content

Commit aebaa80

Browse files
committed
Fixed a null reference exception when logging user info.
1 parent 474284d commit aebaa80

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

dist/exceptionless.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/exceptionless.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/configuration/Configuration.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,15 @@ export class Configuration implements IConfigurationSettings {
150150
public setUserIdentity(identity:string): void;
151151
public setUserIdentity(identity:string, name:string): void;
152152
public setUserIdentity(userInfoOrIdentity:IUserInfo|string, name?:string): void {
153-
var userInfo = typeof userInfoOrIdentity !== 'string' ? userInfoOrIdentity : { identity: userInfoOrIdentity, name: name };
154-
if (!userInfo || (!userInfo.identity && !userInfo.name)) {
153+
var userInfo:IUserInfo = typeof userInfoOrIdentity !== 'string' ? userInfoOrIdentity : { identity: userInfoOrIdentity, name: name };
154+
var shouldRemove:boolean = !userInfo || (!userInfo.identity && !userInfo.name);
155+
if (shouldRemove) {
155156
delete this.defaultData['@user'];
156157
} else {
157158
this.defaultData['@user'] = userInfo;
158159
}
159160

160-
this.log.info(`user identity set to: ${!userInfo.identity && !userInfo.name ? 'null' : userInfo.identity}`);
161+
this.log.info(`user identity set to: ${shouldRemove ? 'null' : userInfo.identity}`);
161162
}
162163

163164
public useReferenceIds(): void {

0 commit comments

Comments
 (0)