diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 2 | ||||
-rw-r--r-- | src/map/channel.c | 19 | ||||
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/guild.c | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index dceb8716a..190b2179a 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8765,7 +8765,7 @@ ACMD(channel) { if (strcmpi(subcmd,"create") == 0 && (channel->config->allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))) { // sub1 = channel name; sub2 = password; sub3 = unused size_t len = strlen(sub1); - const char *pass = *sub2 ? sub2 : NULL; + const char *pass = *sub2 ? sub2 : ""; if (sub1[0] != '#') { clif->message(fd, msg_fd(fd,1405));// Channel name must start with a '#' return false; 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]; diff --git a/src/map/clif.c b/src/map/clif.c index 9c172a2ee..a229cef66 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10116,7 +10116,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) if (chan) { int k; ARR_FIND(0, sd->channel_count, k, sd->channels[k] == chan); - if (k < sd->channel_count || channel->join(chan, sd, NULL, true) == HCS_STATUS_OK) { + if (k < sd->channel_count || channel->join(chan, sd, "", true) == HCS_STATUS_OK) { channel->send(chan,sd,message); } else { clif->message(fd, msg_fd(fd,1402)); diff --git a/src/map/guild.c b/src/map/guild.c index 15c65ec98..ac9322b6b 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -740,7 +740,7 @@ void guild_member_joined(struct map_session_data *sd) sd->guild = g; if (channel->config->ally && channel->config->ally_autojoin) { - channel->join(g->channel, sd, NULL, true); + channel->join(g->channel, sd, "", true); } } |