mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-10 07:08:05 -05:00
darkirc/irc: Fix potential panic when adding nicks to channel nicklists.
This commit is contained in:
@@ -214,9 +214,12 @@ impl Client {
|
||||
let msg_for_self = *self.nickname.read().await == privmsg.channel;
|
||||
|
||||
if have_channel || msg_for_self {
|
||||
// Add the nickname to the list of nicks on the channel
|
||||
(*self.server.channels.write().await).get_mut(&privmsg.channel)
|
||||
.unwrap().nicks.insert(privmsg.nick.clone());
|
||||
// Add the nickname to the list of nicks on the channel, if it's a channel.
|
||||
let mut chans_lock = self.server.channels.write().await;
|
||||
if let Some(chan) = chans_lock.get_mut(&privmsg.channel) {
|
||||
chan.nicks.insert(privmsg.nick.clone());
|
||||
}
|
||||
drop(chans_lock);
|
||||
|
||||
// Format the message
|
||||
let msg = format!("PRIVMSG {} :{}", privmsg.channel, privmsg.msg);
|
||||
|
||||
Reference in New Issue
Block a user