pgbackrest.git / summary / log / commit / refs
commit 5504f286eb6765d3131f2ff99cb2b464a02c4589
Author: Cynthia Shang <cynthia.shang@crunchydata.com>
Commit: David Steele <david@pgmasters.net>
Date: Wed Apr 03 11:32:56 2019 +0000
Add test and asserts missed in abba2bd1.
Contributed by Cynthia Shang.
src/common/type/stringList.c | 2 ++
test/src/module/common/typeStringTest.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/common/type/stringList.c b/src/common/type/stringList.c
index f154b51e5..4dcd55f89 100644
--- a/src/common/type/stringList.c
+++ b/src/common/type/stringList.c
@@ -500,10 +500,12 @@ strLstMergeAnti(const StringList *this, const StringList *anti)
{
bool add = true;
const String *listItem = strLstGet(this, thisIdx);
+ ASSERT(listItem != NULL);
// If anything left in anti look for matches
while (antiIdx < strLstSize(anti))
{
+ ASSERT(strLstGet(anti, antiIdx) != NULL);
int compare = strCmp(listItem, strLstGet(anti, antiIdx));
// If the current item in this is less than the current item in anti then it will be added
diff --git a/test/src/module/common/typeStringTest.c b/test/src/module/common/typeStringTest.c
index 7b10f2d4e..75ce414fc 100644
--- a/test/src/module/common/typeStringTest.c
+++ b/test/src/module/common/typeStringTest.c
@@ -415,6 +415,7 @@ testRun(void)
strLstAddZ(list, "item5");
TEST_RESULT_STR(strPtr(strLstJoin(strLstMergeAnti(list, anti), ", ")), "item1, item4, item5", "list results");
+ TEST_RESULT_STR(strPtr(strLstJoin(strLstMergeAnti(list, strLstNew()), ", ")), "item1, item3, item4, item5", "anti empty");
list = strLstNew();
strLstAddZ(list, "item2");
[parent: be58b8fee799]