# # # patch "project.cc" # from [827a27cad0a963b5359d793837dfa094cc468866] # to [f254868ab4741b8e7739365c570b5760a75fb2c7] # ============================================================ --- project.cc 827a27cad0a963b5359d793837dfa094cc468866 +++ project.cc f254868ab4741b8e7739365c570b5760a75fb2c7 @@ -138,9 +138,16 @@ project_t::get_branch_heads(branch_name if (!app.opts.ignore_suspend_certs) { suspended_in_branch s(app, branch_encoded); - for(std::set::iterator it = branch.second.begin(); it != branch.second.end(); it++) - if (s(*it)) - branch.second.erase(*it); + // Note that this 'for' construct does not itself increment the + // iterator. This trick is necessary because .erase() invalidates + // the iterator that you use it on. + for(std::set::iterator it = branch.second.begin(); it != branch.second.end(); ) + { + std::set::iterator tmp = it; + ++it; + if (s(*tmp)) + branch.second.erase(tmp); + } } L(FL("found heads of branch %s (%s heads)")