From a0d7e03f2e53b115a4b67ae2f1a3e228ab84b063 Mon Sep 17 00:00:00 2001 From: ngn Date: Thu, 22 Aug 2024 02:54:48 +0300 Subject: [PATCH] fix: list function should skip over empty pools --- locale/tr/LC_MESSAGES/libmp.po | 2 +- src/ctx/list.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/locale/tr/LC_MESSAGES/libmp.po b/locale/tr/LC_MESSAGES/libmp.po index 7f6f344..29306ee 100644 --- a/locale/tr/LC_MESSAGES/libmp.po +++ b/locale/tr/LC_MESSAGES/libmp.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-22 00:11+0300\n" +"POT-Creation-Date: 2024-08-22 02:54+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/ctx/list.c b/src/ctx/list.c index a915460..596db8f 100644 --- a/src/ctx/list.c +++ b/src/ctx/list.c @@ -41,9 +41,14 @@ lm_pkg_t *lm_ctx_list_next(lm_ctx_list_t *list){ return list->pkg; } - if((list->pkg = list->pkg->next) && NULL == list->pkg){ - if((list->pool = list->pool->next) != NULL) - list->pkg = list->pool->pkg; + if((list->pkg = list->pkg->next) == NULL){ + next_pool: + if((list->pool = list->pool->next) == NULL) + return list->pkg; + + if((list->pkg = list->pool->pkg) == NULL) + goto next_pool; + return list->pkg; }