From c9e63883ffa7ad1eeac5177ef4067572f5d2485e Mon Sep 17 00:00:00 2001 From: Colin Pitrat Date: Thu, 6 Sep 2018 15:09:30 +0100 Subject: [PATCH] Add missing checks for null pointers --- src/common/plugin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/plugin.c b/src/common/plugin.c index 1db11f35..c67bdaa1 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1410,6 +1410,8 @@ hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name) break; case LIST_USERS: + if (!xlist->pos) + return (time_t) -1; data = xlist->pos->data; switch (hash) { @@ -1431,7 +1433,8 @@ hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name) /* a NULL xlist is a shortcut to current "channels" context */ if (xlist) { - data = xlist->pos->data; + if (xlist->pos) + data = xlist->pos->data; type = xlist->type; } @@ -1522,7 +1525,8 @@ hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name) /* a NULL xlist is a shortcut to current "channels" context */ if (xlist) { - data = xlist->pos->data; + if (xlist->pos) + data = xlist->pos->data; type = xlist->type; }