mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-28 15:35:36 +00:00
default to None if "name" in m.room.name
is empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
3e902836cc
commit
dda3b0e7e2
|
@ -230,10 +230,9 @@ impl Service {
|
|||
|
||||
pub fn get_name(&self, room_id: &RoomId) -> Result<Option<String>> {
|
||||
services().rooms.state_accessor.room_state_get(room_id, &StateEventType::RoomName, "")?.map_or(Ok(None), |s| {
|
||||
serde_json::from_str(s.content.get()).map(|c: RoomNameEventContent| Some(c.name)).map_err(|e| {
|
||||
error!("Invalid room name event in database for room {}. {}", room_id, e);
|
||||
Error::bad_database("Invalid room name event in database.")
|
||||
})
|
||||
Ok(serde_json::from_str(s.content.get())
|
||||
.map(|c: RoomNameEventContent| Some(c.name))
|
||||
.unwrap_or_else(|_| None))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue