Check if data->func is NULL and if so, early return

This commit is contained in:
twinaphex 2016-07-04 11:32:43 +02:00
parent 5d70242dee
commit b2bc4cd300
1 changed files with 3 additions and 2 deletions

View File

@ -97,8 +97,9 @@ static void *thread_wrap(void *data_)
#endif
{
struct thread_data *data = (struct thread_data*)data_;
if (!data)
if (!data || !data->func)
return 0;
if (data->userdata)
data->func(data->userdata);
free(data);
return 0;