mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-04 00:23:27 +08:00
fix(lua): fix script array iterator being potentially invalidated while iterating due to new scripts that could be added and the vector getting reallocated due to it. (#1883)
This commit is contained in:
parent
ae97322ece
commit
0e0b4d46a4
@ -231,8 +231,11 @@ namespace big
|
||||
{
|
||||
std::lock_guard guard(m_registered_scripts_mutex);
|
||||
|
||||
for (auto& script : m_registered_scripts)
|
||||
const auto script_count = m_registered_scripts.size();
|
||||
for (size_t i = 0; i < script_count; i++)
|
||||
{
|
||||
const auto script = m_registered_scripts[i].get();
|
||||
|
||||
if (script->is_enabled())
|
||||
{
|
||||
script->tick();
|
||||
|
Loading…
x
Reference in New Issue
Block a user