diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-06 08:29:16 -0500 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-12-06 08:29:16 -0500 |
commit | bef4faf973f2caf501a456f1e78b3520a2f47410 (patch) | |
tree | 8519e22b274614f5abedeb943f70a71a9d3403a5 | |
parent | 4c3d47f53037aa17b2047e755ffeb47c5ffc5692 (diff) | |
download | stasis-bef4faf973f2caf501a456f1e78b3520a2f47410.tar.gz |
Check whether arch and platform are populated before accessing them
-rw-r--r-- | src/cli/stasis_indexer/helpers.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cli/stasis_indexer/helpers.c b/src/cli/stasis_indexer/helpers.c index 87ab922..cfc1ed6 100644 --- a/src/cli/stasis_indexer/helpers.c +++ b/src/cli/stasis_indexer/helpers.c @@ -8,8 +8,10 @@ struct StrList *get_architectures(struct Delivery ctx[], const size_t nelem) { struct StrList *architectures = strlist_init(); for (size_t i = 0; i < nelem; i++) { - if (!strstr_array(architectures->data, ctx[i].system.arch)) { - strlist_append(&architectures, ctx[i].system.arch); + if (ctx[i].system.arch) { + if (!strstr_array(architectures->data, ctx[i].system.arch)) { + strlist_append(&architectures, ctx[i].system.arch); + } } } return architectures; @@ -18,8 +20,10 @@ struct StrList *get_architectures(struct Delivery ctx[], const size_t nelem) { struct StrList *get_platforms(struct Delivery ctx[], const size_t nelem) { struct StrList *platforms = strlist_init(); for (size_t i = 0; i < nelem; i++) { - if (!strstr_array(platforms->data, ctx[i].system.platform[DELIVERY_PLATFORM_RELEASE])) { - strlist_append(&platforms, ctx[i].system.platform[DELIVERY_PLATFORM_RELEASE]); + if (ctx[i].system.platform) { + if (!strstr_array(platforms->data, ctx[i].system.platform[DELIVERY_PLATFORM_RELEASE])) { + strlist_append(&platforms, ctx[i].system.platform[DELIVERY_PLATFORM_RELEASE]); + } } } return platforms; |