hotfix panic, fixes #36
This commit is contained in:
parent
70ef60c934
commit
c6049a7451
2 changed files with 6 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ import (
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/getsentry/sentry-go"
|
||||||
"github.com/raja/argon2pw"
|
"github.com/raja/argon2pw"
|
||||||
"gitlab.com/etke.cc/go/mxidwc"
|
"gitlab.com/etke.cc/go/mxidwc"
|
||||||
"maunium.net/go/mautrix/id"
|
"maunium.net/go/mautrix/id"
|
||||||
|
|
@ -40,7 +41,7 @@ func (b *Bot) allowOwner(actorID id.UserID, targetRoomID id.RoomID) bool {
|
||||||
}
|
}
|
||||||
cfg, err := b.getRoomSettings(targetRoomID)
|
cfg, err := b.getRoomSettings(targetRoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Error(context.Background(), targetRoomID, "failed to retrieve settings: %v", err)
|
b.Error(sentry.SetHubOnContext(context.Background(), sentry.CurrentHub()), targetRoomID, "failed to retrieve settings: %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +64,7 @@ func (b *Bot) allowSend(actorID id.UserID, targetRoomID id.RoomID) bool {
|
||||||
|
|
||||||
cfg, err := b.getRoomSettings(targetRoomID)
|
cfg, err := b.getRoomSettings(targetRoomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Error(context.Background(), targetRoomID, "failed to retrieve settings: %v", err)
|
b.Error(sentry.SetHubOnContext(context.Background(), sentry.CurrentHub()), targetRoomID, "failed to retrieve settings: %v", err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,9 @@ func (b *Bot) getBotSettings() botSettings {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.log.Error("cannot get bot settings: %v", utils.UnwrapError(err))
|
b.log.Error("cannot get bot settings: %v", utils.UnwrapError(err))
|
||||||
}
|
}
|
||||||
|
if config == nil {
|
||||||
|
config = map[string]string{}
|
||||||
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue