From 7fd71c8f076f9eb081f2ba527c70f277afeb262f Mon Sep 17 00:00:00 2001 From: Sijmen Date: Thu, 23 Nov 2023 11:45:55 +0100 Subject: [PATCH] Fix crash after some while --- src/irc_handler.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/irc_handler.rs b/src/irc_handler.rs index b4279ea..851ef8c 100644 --- a/src/irc_handler.rs +++ b/src/irc_handler.rs @@ -34,15 +34,16 @@ pub async fn message_loop( loop { select! { val = irc_stream.next() => { - if let Some(message) = val.transpose()? { + if let Some(Ok(message)) = val { println!("[Rx] {}", message.to_string().trim()); message_tx.send(message)?; } } val = input_rx.recv() => { - let message = val.unwrap(); - println!("[Tx] {}", message.to_string().trim()); - client.send(message)?; + if let Some(message) = val { + println!("[Tx] {}", message.to_string().trim()); + client.send(message)?; + } } } }