summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/command.c3
-rw-r--r--src/gui/gui-buffer.c4
-rw-r--r--src/irc/irc-channel.c3
-rw-r--r--src/irc/irc-dcc.c6
-rw-r--r--src/irc/irc-nick.c8
-rw-r--r--src/irc/irc-server.c6
6 files changed, 25 insertions, 5 deletions
diff --git a/src/common/command.c b/src/common/command.c
index 55a41621a..5d218409e 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -1449,9 +1449,10 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
if (CHANNEL(buffer)
&& (CHANNEL(buffer)->type == CHANNEL_TYPE_DCC_CHAT))
{
+ ptr_server = SERVER(buffer);
ptr_channel = CHANNEL(buffer);
gui_buffer_free (ptr_channel->buffer, 1);
- channel_free (SERVER(buffer), ptr_channel);
+ channel_free (ptr_server, ptr_channel);
gui_status_draw (gui_current_window->buffer, 1);
gui_input_draw (gui_current_window->buffer, 1);
}
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index a57299af3..17b8fda6a 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -443,8 +443,8 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
gui_buffer_raw_data = NULL;
/* purge DCC chat using this buffer */
- if (CHANNEL(buffer))
- dcc_chat_remove_channel (CHANNEL(buffer));
+ //if (CHANNEL(buffer))
+ // dcc_chat_remove_channel (CHANNEL(buffer));
for (ptr_server = irc_servers; ptr_server;
ptr_server = ptr_server->next_server)
diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c
index e5c6a0d51..7156cd7ca 100644
--- a/src/irc/irc-channel.c
+++ b/src/irc/irc-channel.c
@@ -95,6 +95,9 @@ channel_free (t_irc_server *server, t_irc_channel *channel)
{
t_irc_channel *new_channels;
+ if (!server || !channel)
+ return;
+
/* close DCC CHAT */
if ((t_irc_dcc *)(channel->dcc_chat) &&
(!DCC_ENDED(((t_irc_dcc *)(channel->dcc_chat))->status)))
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index f68274762..d8337644d 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -345,6 +345,9 @@ dcc_free (t_irc_dcc *ptr_dcc)
{
t_irc_dcc *new_dcc_list;
+ if (!ptr_dcc)
+ return;
+
/* DCC CHAT with channel => remove channel
(to prevent channel from becoming standard pv) */
if (ptr_dcc->channel)
@@ -354,7 +357,8 @@ dcc_free (t_irc_dcc *ptr_dcc)
|| (DCC_ENDED(((t_irc_dcc *)(ptr_dcc->channel->dcc_chat))->status)))
{
gui_buffer_free (ptr_dcc->channel->buffer, 1);
- channel_free (ptr_dcc->server, ptr_dcc->channel);
+ if (ptr_dcc->channel)
+ channel_free (ptr_dcc->server, ptr_dcc->channel);
}
}
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c
index 3e6f231cb..a3ec4fa6b 100644
--- a/src/irc/irc-nick.c
+++ b/src/irc/irc-nick.c
@@ -267,7 +267,10 @@ void
nick_free (t_irc_channel *channel, t_irc_nick *nick)
{
t_irc_nick *new_nicks;
-
+
+ if (!channel || !nick)
+ return;
+
/* remove nick from queue */
if (channel->last_nick == nick)
channel->last_nick = nick->prev_nick;
@@ -300,6 +303,9 @@ nick_free (t_irc_channel *channel, t_irc_nick *nick)
void
nick_free_all (t_irc_channel *channel)
{
+ if (!channel)
+ return;
+
/* remove all nicks for the channel */
while (channel->nicks)
nick_free (channel, channel->nicks);
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 3ab6978fe..0422a3778 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -283,6 +283,9 @@ server_alloc ()
void
server_destroy (t_irc_server *server)
{
+ if (!server)
+ return;
+
/* free data */
if (server->name)
free (server->name);
@@ -333,6 +336,9 @@ server_free (t_irc_server *server)
{
t_irc_server *new_irc_servers;
+ if (!server)
+ return;
+
/* close any opened channel/private */
while (server->channels)
channel_free (server, server->channels);