mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:26:38 +02:00
irc: add extra check on argument "nick" in functions "irc_nick_set_*"
This commit is contained in:
@@ -125,6 +125,9 @@ irc_nick_set_current_prefix (struct t_irc_nick *nick)
|
||||
{
|
||||
char *ptr_prefixes;
|
||||
|
||||
if (!nick)
|
||||
return;
|
||||
|
||||
nick->prefix[0] = ' ';
|
||||
for (ptr_prefixes = nick->prefixes; ptr_prefixes[0]; ptr_prefixes++)
|
||||
{
|
||||
@@ -149,6 +152,9 @@ irc_nick_set_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
|
||||
{
|
||||
int index;
|
||||
|
||||
if (!nick)
|
||||
return;
|
||||
|
||||
index = irc_server_get_prefix_char_index (server, prefix);
|
||||
if (index >= 0)
|
||||
{
|
||||
@@ -167,6 +173,9 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
|
||||
{
|
||||
const char *ptr_prefixes;
|
||||
|
||||
if (!nick)
|
||||
return;
|
||||
|
||||
/* reset all prefixes in nick */
|
||||
memset (nick->prefixes, ' ', strlen (nick->prefixes));
|
||||
|
||||
@@ -190,6 +199,9 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
|
||||
void
|
||||
irc_nick_set_host (struct t_irc_nick *nick, const char *host)
|
||||
{
|
||||
if (!nick)
|
||||
return;
|
||||
|
||||
/* if host is the same, just return */
|
||||
if ((!nick->host && !host)
|
||||
|| (nick->host && host && strcmp (nick->host, host) == 0))
|
||||
|
||||
Reference in New Issue
Block a user