diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-04 13:18:39 -0400 |
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2026-06-22 10:13:08 -0400 |
| commit | 64bc08022716291b8bd388d28506ca4c35f70f6b (patch) | |
| tree | c6bc0d2a079c68603a63ddc02df7fb42ac30341c /src/lib | |
| parent | 886e12d18c6231573870a662635e5a23d304a976 (diff) | |
| download | stasis-64bc08022716291b8bd388d28506ca4c35f70f6b.tar.gz | |
strlist_contains: Allow index result argument to be NULL
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/core/strlist.c | 8 |
1 files changed, 6 insertions, 2 deletions
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; } } |
