Skip to content

Commit 2f8c2b9

Browse files
committed
fix: ispaused invalid iterator
1 parent ccce734 commit 2f8c2b9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/sourcehook/sourcehook_impl.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,19 @@ namespace SourceHook
256256

257257
ICleanupTask *m_CleanupTask;
258258

259+
bool isValidIterator(std::list<Item>& myList, std::list<Item>::iterator it) {
260+
for (auto iter = myList.begin(); iter != myList.end(); ++iter) {
261+
if (iter == it) {
262+
return true;
263+
}
264+
}
265+
return false;
266+
}
267+
259268
void SkipPaused(List<CHook>::iterator &iter, List<CHook> &list)
260269
{
270+
if (!iter || !isValidIterator(iter))
271+
iter = list.begin();
261272
while (iter != list.end() && iter->IsPaused())
262273
++iter;
263274
}

0 commit comments

Comments
 (0)