From bfc738d80e9ffe8f1037ba59ac3867a15f338f4d Mon Sep 17 00:00:00 2001
From: strawberry <strawberry@puppygock.gay>
Date: Mon, 15 Jan 2024 01:51:27 -0500
Subject: [PATCH] default to None for room topic event in spaces or
 /publicRooms

Signed-off-by: strawberry <strawberry@puppygock.gay>
---
 src/api/client_server/directory.rs | 3 ++-
 src/service/rooms/spaces/mod.rs    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/api/client_server/directory.rs b/src/api/client_server/directory.rs
index a54d2aba..52ac1b20 100644
--- a/src/api/client_server/directory.rs
+++ b/src/api/client_server/directory.rs
@@ -246,7 +246,8 @@ pub(crate) async fn get_public_rooms_filtered_helper(
                                 error!("Invalid room topic event in database for room {}", room_id);
                                 Error::bad_database("Invalid room topic event in database.")
                             })
-                    })?,
+                    })
+                    .unwrap_or_default(),
                 world_readable: services()
                     .rooms
                     .state_accessor
diff --git a/src/service/rooms/spaces/mod.rs b/src/service/rooms/spaces/mod.rs
index 12e16d22..4c763e86 100644
--- a/src/service/rooms/spaces/mod.rs
+++ b/src/service/rooms/spaces/mod.rs
@@ -346,7 +346,8 @@ impl Service {
                             error!("Invalid room topic event in database for room {}", room_id);
                             Error::bad_database("Invalid room topic event in database.")
                         })
-                })?,
+                })
+                .unwrap_or_default(),
             world_readable: services()
                 .rooms
                 .state_accessor