mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 09:23:09 -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{}
|
var value interface{}
|
||||||
if attrName == "aliases" {
|
if attrName == "aliases" {
|
||||||
// Aliases need a special conversion
|
// 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
|
// 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 {
|
} else {
|
||||||
value = attrValue
|
value = attrValue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue