Prevent 'dereference before null check'

This commit is contained in:
twinaphex 2017-01-18 17:53:25 +01:00
parent b9104f38b8
commit aa47903520

View File

@ -69,6 +69,8 @@ void task_file_load_handler(retro_task_t *task)
{ {
nbio_handle_t *nbio = (nbio_handle_t*)task->state; nbio_handle_t *nbio = (nbio_handle_t*)task->state;
if (nbio)
{
switch (nbio->status) switch (nbio->status)
{ {
case NBIO_STATUS_INIT: case NBIO_STATUS_INIT:
@ -76,6 +78,7 @@ void task_file_load_handler(retro_task_t *task)
{ {
const char *fullpath = nbio->path; const char *fullpath = nbio->path;
struct nbio_t *handle = nbio_open(fullpath, NBIO_READ); struct nbio_t *handle = nbio_open(fullpath, NBIO_READ);
if (handle) if (handle)
{ {
nbio->handle = handle; nbio->handle = handle;
@ -127,6 +130,7 @@ void task_file_load_handler(retro_task_t *task)
task_set_finished(task, true); task_set_finished(task, true);
break; break;
} }
}
if (task_get_cancelled(task)) if (task_get_cancelled(task))
{ {