mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Don't accidentally try to type-assert nil
This commit is contained in:
parent
8642c0b2fa
commit
c3dd404778
|
|
@ -25,9 +25,14 @@ func (c *InMemoryLRUCache) GetRoomVersion(roomID string) (gomatrixserverlib.Room
|
|||
return "", false
|
||||
}
|
||||
c.roomVersionsMutex.RLock()
|
||||
defer c.roomVersionsMutex.RUnlock()
|
||||
val, found := c.roomVersions.Get(roomID)
|
||||
return val.(gomatrixserverlib.RoomVersion), found
|
||||
c.roomVersionsMutex.RUnlock()
|
||||
if found && val != nil {
|
||||
if roomVersion, ok := val.(gomatrixserverlib.RoomVersion); ok {
|
||||
return roomVersion, true
|
||||
}
|
||||
}
|
||||
return "", false
|
||||
}
|
||||
|
||||
func (c *InMemoryLRUCache) StoreRoomVersion(roomID string, roomVersion gomatrixserverlib.RoomVersion) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue