diff options
author | Wim <wim@42.be> | 2021-10-24 22:17:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-24 22:17:46 +0200 |
commit | b1f403165d6df6af1010ab49305a5968a8a8c4b6 (patch) | |
tree | 2340113e2dd1f36f29183d0804187d711effc7df /bridge/msteams | |
parent | 46e4317b77d686a626d37f2eb1c85c6c19f6b665 (diff) | |
download | matterbridge-msglm-b1f403165d6df6af1010ab49305a5968a8a8c4b6.tar.gz matterbridge-msglm-b1f403165d6df6af1010ab49305a5968a8a8c4b6.tar.bz2 matterbridge-msglm-b1f403165d6df6af1010ab49305a5968a8a8c4b6.zip |
Fix panic in msteams. Fixes #1588 (#1622)
Diffstat (limited to 'bridge/msteams')
-rw-r--r-- | bridge/msteams/msteams.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bridge/msteams/msteams.go b/bridge/msteams/msteams.go index 87a15a7a..27d7bee0 100644 --- a/bridge/msteams/msteams.go +++ b/bridge/msteams/msteams.go @@ -19,8 +19,10 @@ import ( "golang.org/x/oauth2" ) -var defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"} -var attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`) +var ( + defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"} + attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`) +) type Bmsteams struct { gc *msgraph.GraphServiceRequestBuilder @@ -50,7 +52,7 @@ func (b *Bmsteams) Connect() error { b.Log.Errorf("Couldn't save sessionfile in %s: %s", tokenCachePath, err) } // make file readable only for matterbridge user - err = os.Chmod(tokenCachePath, 0600) + err = os.Chmod(tokenCachePath, 0o600) if err != nil { b.Log.Errorf("Couldn't change permissions for %s: %s", tokenCachePath, err) } @@ -168,7 +170,7 @@ func (b *Bmsteams) poll(channelName string) error { } // skip non-user message for now. - if msg.From.User == nil { + if msg.From == nil || msg.From.User == nil { continue } |