summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-05-14 07:26:48 +0200
committerSébastien Helleu <flashcode@flashtux.org>2019-05-14 07:26:48 +0200
commit34adcde2ff9e5e8e0cfcb7dbd028e5c5524764b3 (patch)
tree5feb28afdea2d210a492efd6567bceed00c3fb52
parentf6d6f7bac555478a3f3b62853a8dc606f11ad313 (diff)
downloadweechat-34adcde2ff9e5e8e0cfcb7dbd028e5c5524764b3.zip
irc: add extra check on argument "nick" in functions "irc_nick_set_*"
-rw-r--r--src/plugins/irc/irc-nick.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/irc/irc-nick.c b/src/plugins/irc/irc-nick.c
index 5295016b5..57bb1d601 100644
--- a/src/plugins/irc/irc-nick.c
+++ b/src/plugins/irc/irc-nick.c
@@ -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))