From da1ab24c574e2830e442fe999c102ba307806039 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 9 May 2017 07:13:47 +0200 Subject: [PATCH] Cleanups --- tasks/task_image.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tasks/task_image.c b/tasks/task_image.c index d9240bbb1d..971b720bfb 100644 --- a/tasks/task_image.c +++ b/tasks/task_image.c @@ -226,15 +226,10 @@ static void task_image_load_free_internal(nbio_handle_t *nbio) static int cb_nbio_generic(nbio_handle_t *nbio, size_t *len) { - void *ptr = NULL; struct nbio_image_handle *image = (struct nbio_image_handle*)nbio->data; + void *ptr = nbio_get_ptr(nbio->handle, len); - if (!image || !image->handle) - goto error; - - ptr = nbio_get_ptr(nbio->handle, len); - - if (!ptr) + if (!ptr || !image || !image->handle) goto error; image_transfer_set_buffer_ptr(image->handle, nbio->image_type, ptr); @@ -369,11 +364,11 @@ bool task_push_image_load(const char *fullpath, retro_task_callback_t cb, void * nbio->status = NBIO_STATUS_INIT; - t->state = nbio; - t->handler = task_file_load_handler; - t->cleanup = task_image_load_free; - t->callback = cb; - t->user_data = user_data; + t->state = nbio; + t->handler = task_file_load_handler; + t->cleanup = task_image_load_free; + t->callback = cb; + t->user_data = user_data; task_queue_ctl(TASK_QUEUE_CTL_PUSH, t);