From a304b42f731b3fee86dc1339fc78ccde7dee7c42 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Sep 2016 11:07:56 +0200 Subject: [PATCH] (task_database.c) Cleanup --- tasks/task_database.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tasks/task_database.c b/tasks/task_database.c index 86bc18bd02..d5e469b5a4 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -480,12 +480,7 @@ static int task_database_iterate_serial_lookup( static int task_database_iterate(database_state_handle_t *db_state, database_info_handle_t *db) { - const char *name = NULL; - - if (!db) - return -1; - - name = database_info_get_current_element_name(db); + const char *name = database_info_get_current_element_name(db); if (!name) return 0; @@ -549,12 +544,12 @@ static void task_database_handler(retro_task_t *task) switch (dbinfo->status) { case DATABASE_STATUS_ITERATE_BEGIN: + if (dbstate && !dbstate->list) { settings_t *settings = config_get_ptr(); - if (dbstate && !dbstate->list) - dbstate->list = dir_list_new_special( - settings->path.content_database, - DIR_LIST_DATABASES, NULL); + dbstate->list = dir_list_new_special( + settings->path.content_database, + DIR_LIST_DATABASES, NULL); } dbinfo->status = DATABASE_STATUS_ITERATE_START; break; @@ -566,7 +561,7 @@ static void task_database_handler(retro_task_t *task) task_database_iterate_start(dbinfo, name); break; case DATABASE_STATUS_ITERATE: - if (task_database_iterate(&db->state, dbinfo) == 0) + if (dbstate && task_database_iterate(dbstate, dbinfo) == 0) { dbinfo->status = DATABASE_STATUS_ITERATE_NEXT; dbinfo->type = DATABASE_TYPE_ITERATE;