mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix crash due to erase/remove typo
A race condition would result in trying to remove an element that didn't exist, and thus erasing end (undefined behavior) instead of erasing [end, end) (no-op)
This commit is contained in:
parent
f45256baf1
commit
1db17ae1ec
@ -15,7 +15,7 @@ public:
|
||||
// Qt
|
||||
inline bool isEmpty() { return v.empty(); }
|
||||
bool contains(int i) { return std::find_if(begin(), end(), [i](T& t){return (int)t == i;}) != end(); }
|
||||
void remove(int i) { v.erase(std::remove_if(begin(), end(), [i](T& t){return (int)t == i;})); }
|
||||
void remove(int i) { v.erase(std::remove_if(begin(), end(), [i](T& t){return (int)t == i;}), end()); }
|
||||
T& operator[](int i)
|
||||
{
|
||||
iterator it = std::find_if(begin(), end(), [i](T& t){return (int)t == i;});
|
||||
|
Loading…
x
Reference in New Issue
Block a user