Skip to content

Commit

Permalink
fix #54
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Oct 20, 2016
1 parent 6cbb467 commit dda941b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wechaty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ export class Wechaty extends EventEmitter implements Sayable {
return this.npmVersion
}

public user(): Contact | null { return this.puppet && this.puppet.user }
public user(): Contact {
if (!this.puppet || !this.puppet.user) {
throw new Error('no user')
}
return this.puppet.user
}

public reset(reason?: string) {
log.verbose('Wechaty', 'reset() because %s', reason)
Expand Down

0 comments on commit dda941b

Please sign in to comment.