mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-10 16:33:11 -06:00
Add a check on type
This commit is contained in:
parent
10c2bb3743
commit
6ecefebcd1
|
|
@ -226,10 +226,12 @@ func (s *publicRoomsStatements) updateRoomAttribute(attrName string, attrValue a
|
|||
var value interface{}
|
||||
if attrName == "aliases" {
|
||||
// Aliases need a special conversion
|
||||
if value, err = pq.StringArray(attrValue.([]string)); err != nil {
|
||||
valueAsSlice, isSlice := attrValue.([]string)
|
||||
if !isSlice {
|
||||
// attrValue isn't a slice of strings
|
||||
return err
|
||||
return errors.New("New list of aliases is of the wrong type")
|
||||
}
|
||||
value = pq.StringArray(valueAsSlice)
|
||||
} else {
|
||||
value = attrValue
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue