summaryrefslogtreecommitdiff
path: root/src/map/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/channel.c')
-rw-r--r--src/map/channel.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/map/channel.c b/src/map/channel.c
index 6e15d072e..529d3155e 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -255,6 +255,7 @@ void channel_send(struct channel_data *chan, struct map_session_data *sd, const
{
char message[150];
nullpo_retv(chan);
+ nullpo_retv(msg);
if (sd && chan->msg_delay != 0
&& DIFF_TICK(sd->hchsysch_tick + chan->msg_delay*1000, timer->gettick()) > 0
@@ -262,14 +263,14 @@ void channel_send(struct channel_data *chan, struct map_session_data *sd, const
clif->messagecolor_self(sd->fd, COLOR_RED, msg_sd(sd,1455));
return;
} else if (sd) {
- snprintf(message, 150, "[ #%s ] %s : %s",chan->name,sd->status.name, msg);
+ safesnprintf(message, 150, "[ #%s ] %s : %s", chan->name, sd->status.name, msg);
clif->channel_msg(chan,sd,message);
if (chan->type == HCS_TYPE_IRC)
ircbot->relay(sd->status.name,msg);
if (chan->msg_delay != 0)
sd->hchsysch_tick = timer->gettick();
} else {
- snprintf(message, 150, "[ #%s ] %s",chan->name, msg);
+ safesnprintf(message, 150, "[ #%s ] %s", chan->name, msg);
clif->channel_msg2(chan, message);
if (chan->type == HCS_TYPE_IRC)
ircbot->relay(NULL, msg);
@@ -329,6 +330,7 @@ enum channel_operation_status channel_join(struct channel_data *chan, struct map
nullpo_retr(HCS_STATUS_FAIL, chan);
nullpo_retr(HCS_STATUS_FAIL, sd);
+ nullpo_retr(HCS_STATUS_FAIL, password);
if (idb_exists(chan->users, sd->status.char_id)) {
return HCS_STATUS_ALREADY;
@@ -445,6 +447,7 @@ void channel_leave(struct channel_data *chan, struct map_session_data *sd)
*/
void channel_quit(struct map_session_data *sd)
{
+ nullpo_retv(sd);
while (sd->channel_count > 0) {
// Loop downward to avoid unnecessary array compactions by channel_leave
struct channel_data *chan = sd->channels[sd->channel_count-1];
@@ -461,10 +464,11 @@ void channel_quit(struct map_session_data *sd)
/**
* Joins the local map channel.
*
- * @param sd The target character
+ * @param sd The target character (sd must be non null)
*/
void channel_map_join(struct map_session_data *sd)
{
+ nullpo_retv(sd);
if (sd->state.autotrade || sd->state.standalone)
return;
if (!map->list[sd->bl.m].channel) {
@@ -475,18 +479,20 @@ void channel_map_join(struct map_session_data *sd)
map->list[sd->bl.m].channel->m = sd->bl.m;
}
- channel->join(map->list[sd->bl.m].channel, sd, NULL, false);
+ channel->join(map->list[sd->bl.m].channel, sd, "", false);
}
void channel_irc_join(struct map_session_data *sd)
{
struct channel_data *chan = ircbot->channel;
+
+ nullpo_retv(sd);
if (sd->state.autotrade || sd->state.standalone)
return;
if (channel->config->irc_name[0] == '\0')
return;
if (chan)
- channel->join(chan, sd, NULL, false);
+ channel->join(chan, sd, "", false);
}
/**
@@ -548,12 +554,13 @@ void channel_guild_leave_alliance(const struct guild *g_source, const struct gui
/**
* Makes a character quit all guild-related channels.
*
- * @param sd The character
+ * @param sd The character (must be non null)
*/
void channel_quit_guild(struct map_session_data *sd)
{
unsigned char i;
+ nullpo_retv(sd);
for (i = 0; i < sd->channel_count; i++) {
struct channel_data *chan = sd->channels[i];