Skip to content

Commit

Permalink
Linux/arm crash fix (segmentation fault): added a check to verify ite…
Browse files Browse the repository at this point in the history
…mList validity (empty) (#3301)
  • Loading branch information
R4ven47 committed Jan 30, 2024
1 parent a3c6f0f commit 6680737
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Shared/sdk/CFastList.h
Expand Up @@ -307,6 +307,8 @@ class CFastList
template <class T, class U>
bool ListContains(const CFastList<T*>& itemList, const U& item)
{
if (itemList.empty())
return false;
return itemList.contains(item);
}

Expand Down
3 changes: 2 additions & 1 deletion Shared/sdk/SharedUtil.Misc.h
Expand Up @@ -344,13 +344,14 @@ namespace SharedUtil
template <class TL, class T>
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 <class TL, class T>
void ListAddUnique(TL& itemList, const T& item)
Expand Down

0 comments on commit 6680737

Please sign in to comment.