From 38a322f7cbd213e2324b85eb9eb14cdd2e466e70 Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Sun, 7 Jan 2024 14:17:08 +0100 Subject: [PATCH] Cleaner panic message for Envelope::source_address --- libsignal-service/src/envelope.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libsignal-service/src/envelope.rs b/libsignal-service/src/envelope.rs index 868ba9137..8a44a69f8 100644 --- a/libsignal-service/src/envelope.rs +++ b/libsignal-service/src/envelope.rs @@ -136,8 +136,10 @@ impl Envelope { let uuid = self .source_service_id .as_deref() - .and_then(|u| Uuid::parse_str(u).ok()) - .expect("valid uuid checked in constructor"); + .map(Uuid::parse_str) + .transpose() + .expect("valid uuid checked in constructor") + .expect("source_service_id is set"); ServiceAddress { uuid } }