10000 core, bugfix: the ineffective iteration over m_keys (#762) · fibjs/fibjs@b912ee5 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit b912ee5

Browse files
authored
core, bugfix: the ineffective iteration over m_keys (#762)
1 parent ccfe88c commit b912ee5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fibjs/include/SimpleObject.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ class NObject : public object_base {
6565
if (it == m_keys.end())
6666
return CALL_RETURN_NULL;
6767

68-
m_values.erase(m_values.begin() + it->second);
68+
int32_t deleted_pos = it->second;
69+
m_values.erase(m_values.begin() + deleted_pos);
6970
m_keys.erase(it);
7071

71-
for (it = m_keys.begin(); it != m_keys.end(); it++) {
72-
if (it->second > it->second)
73-
it->second--;
72+
for (auto& i : m_keys) {
73+
if (i.second > deleted_pos)
74+
i.second--;
7475
}
7576

7677
return 0;

0 commit comments

Comments
 (0)
0