summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/alpm_list.c')
-rw-r--r--lib/libalpm/alpm_list.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index 38cefa62..071cd994 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -547,11 +547,10 @@ inline alpm_list_t SYMEXPORT *alpm_list_next(const alpm_list_t *node)
*
* @return the previous element, or NULL when no previous element exist
*/
-inline alpm_list_t SYMEXPORT *alpm_list_previous(const alpm_list_t *list,
- const alpm_list_t *node)
+inline alpm_list_t SYMEXPORT *alpm_list_previous(const alpm_list_t *list)
{
- if(node && node != list) {
- return node->prev;
+ if(list && list->prev->next) {
+ return list->prev;
} else {
return NULL;
}