Ensure settings map is always initialized
Without this, if settings are not found in account data (`M_NOT_FOUND`), we won't initialize the map and we'll panic later: > assignment to entry in nil map Breaking settings for all new rooms is definitely not what we inteded. Likely a regression since726bc95c26, but related tofcac0a202das well.
This commit is contained in:
@@ -161,7 +161,7 @@ func (b *Bot) getSettings(ctx context.Context, roomID id.RoomID) (settings, erro
|
|||||||
span := sentry.StartSpan(ctx, "http.server", sentry.TransactionName("getSettings"))
|
span := sentry.StartSpan(ctx, "http.server", sentry.TransactionName("getSettings"))
|
||||||
defer span.Finish()
|
defer span.Finish()
|
||||||
|
|
||||||
var config settings
|
config := settings{}
|
||||||
err := b.lp.GetClient().GetRoomAccountData(roomID, settingskey, &config)
|
err := b.lp.GetClient().GetRoomAccountData(roomID, settingskey, &config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(err.Error(), "M_NOT_FOUND") {
|
if strings.Contains(err.Error(), "M_NOT_FOUND") {
|
||||||
|
|||||||
Reference in New Issue
Block a user