- for (it = copyIpcount.begin(); it != copyIpcount.end(); it++) {
- if (inUsersGroups(it->first, groups) != true) { copyIpcount.erase(it->first); }
+ for (it = copyIpcount.begin(); it != copyIpcount.end();) {
+ if (inUsersGroups(it->first, groups) != true) {
+ copyIpcount.erase(it++);
+ }else { it++; }