From c2a6ce52e1789289df87e37adbfa172d4d590579 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 4 Jun 2026 13:18:39 -0400 Subject: strlist_contains: Allow index result argument to be NULL --- src/lib/core/strlist.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/core/strlist.c b/src/lib/core/strlist.c index 60f3a1f..8729266 100644 --- a/src/lib/core/strlist.c +++ b/src/lib/core/strlist.c @@ -171,11 +171,15 @@ int strlist_contains(struct StrList *pStrList, const char *value, size_t *index_ for (size_t i = 0; i < strlist_count(pStrList); i++) { const char *item = strlist_item(pStrList, i); if (!item) { - *index_of = 0; + if (index_of) { + *index_of = 0; + } break; } if (!strcmp(item, value)) { - *index_of = i; + if (index_of) { + *index_of = i; + } return 1; } } -- cgit