From b1c24efda7e57143e341a78bb3b46dcf31c668f1 Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Sun, 7 Jan 2024 14:19:05 +0100 Subject: [PATCH] Short debug format for empty Envelopes --- libsignal-service/src/cipher.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libsignal-service/src/cipher.rs b/libsignal-service/src/cipher.rs index 34477875c..d50e606d6 100644 --- a/libsignal-service/src/cipher.rs +++ b/libsignal-service/src/cipher.rs @@ -47,20 +47,24 @@ impl fmt::Debug for ServiceCipher { } fn debug_envelope(envelope: &Envelope) -> String { - format!( - "Envelope {{ \ + if envelope.content.is_none() { + format!("Envelope {{ empty }}") + } else { + format!( + "Envelope {{ \ source_address: {:?}, \ source_device: {:?}, \ server_guid: {:?}, \ timestamp: {:?}, \ content: {} bytes, \ }}", - envelope.source_address(), - envelope.source_device(), - envelope.server_guid(), - envelope.timestamp(), - envelope.content().len(), - ) + envelope.source_address(), + envelope.source_device(), + envelope.server_guid(), + envelope.timestamp(), + envelope.content().len(), + ) + } } impl ServiceCipher