replace accidental unwraps with if let's

this provides not only some future compatibility with MSC4051,
but it just makes sense to not crash/error if we can't get a server_name
from the room ID and should just use the server_name from the sender
user's invite event. there is already code ahead that accounts for
an empty vector so this is safe.

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-02-23 19:37:48 -05:00 committed by June
parent 81b8f7c380
commit ca42ec338b
2 changed files with 15 additions and 4 deletions

View file

@ -186,15 +186,16 @@ impl Service {
if rooms_in_path.len() < max_depth {
stack.push(children_ids);
}
} else {
let server = current_room.server_name().unwrap();
} else if let Some(server) = current_room.server_name() {
if server == services().globals.server_name() {
continue;
}
if !results.is_empty() {
// Early return so the client can see some data already
break;
}
debug!("Asking {server} for /hierarchy");
if let Ok(response) = services()
.sending