Attempt to prevent crashes in task_image

This commit is contained in:
twinaphex 2016-12-28 00:40:46 +01:00
parent 6708da5ec1
commit 28dedee477

View File

@ -278,6 +278,8 @@ bool task_image_load_handler(retro_task_t *task)
nbio_handle_t *nbio = (nbio_handle_t*)task->state;
struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data;
if (image)
{
switch (image->status)
{
case IMAGE_STATUS_PROCESS_TRANSFER:
@ -303,10 +305,11 @@ bool task_image_load_handler(retro_task_t *task)
default:
break;
}
}
if ( nbio->is_finished
&& image->is_finished
&& !task->cancelled)
if ( (nbio && nbio->is_finished )
&& (image && image->is_finished )
&& (task && !task->cancelled))
{
task->task_data = malloc(sizeof(image->ti));