diff --git a/Shared/sdk/CFastList.h b/Shared/sdk/CFastList.h index 7797e70cca..30f65a1eb0 100644 --- a/Shared/sdk/CFastList.h +++ b/Shared/sdk/CFastList.h @@ -307,6 +307,8 @@ class CFastList template bool ListContains(const CFastList& itemList, const U& item) { + if (itemList.empty()) + return false; return itemList.contains(item); } diff --git a/Shared/sdk/SharedUtil.Misc.h b/Shared/sdk/SharedUtil.Misc.h index 0d17a2f155..d64f155a7c 100644 --- a/Shared/sdk/SharedUtil.Misc.h +++ b/Shared/sdk/SharedUtil.Misc.h @@ -344,13 +344,14 @@ namespace SharedUtil template bool ListContains(const TL& itemList, const T& item) { + if (itemList.empty()) + return false; typename TL ::const_iterator it = itemList.begin(); for (; it != itemList.end(); ++it) if (item == *it) return true; return false; } - // Add item if it does not aleady exist in itemList template void ListAddUnique(TL& itemList, const T& item)