Add missing checks for null pointers

This commit is contained in:
Colin Pitrat
2018-09-06 15:09:30 +01:00
parent c7322f406c
commit c9e63883ff

View File

@@ -1410,6 +1410,8 @@ hexchat_list_time (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
break; break;
case LIST_USERS: case LIST_USERS:
if (!xlist->pos)
return (time_t) -1;
data = xlist->pos->data; data = xlist->pos->data;
switch (hash) switch (hash)
{ {
@@ -1431,6 +1433,7 @@ hexchat_list_str (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
/* a NULL xlist is a shortcut to current "channels" context */ /* a NULL xlist is a shortcut to current "channels" context */
if (xlist) if (xlist)
{ {
if (xlist->pos)
data = xlist->pos->data; data = xlist->pos->data;
type = xlist->type; type = xlist->type;
} }
@@ -1522,6 +1525,7 @@ hexchat_list_int (hexchat_plugin *ph, hexchat_list *xlist, const char *name)
/* a NULL xlist is a shortcut to current "channels" context */ /* a NULL xlist is a shortcut to current "channels" context */
if (xlist) if (xlist)
{ {
if (xlist->pos)
data = xlist->pos->data; data = xlist->pos->data;
type = xlist->type; type = xlist->type;
} }