Boost C++ Libraries: Ticket #12354: boost::asio::connect crash when connect_condition sets iterator to end https://svn.boost.org/trac10/ticket/12354 <p> example: </p> <pre class="wiki"> auto getIPV4Only = [](const error_code&amp; ec, iterator next) { resolver::iterator end; while (!ec &amp;&amp; next != end) { if (next-&gt;endpoint().address().is_v4()) return next; ++next; } return next; }; connect(socket, iterator, getIPV4Only, ec); //&lt;- crashes when getIPV4Only returns end </pre><p> fix: </p> <pre class="wiki"> --- include/boost/asio/impl/connect.hpp (revision 1.6.0) +++ include/boost/asio/impl/connect.hpp (working copy) @@ -122,7 +122,9 @@ s.connect(*iter, ec); if (!ec) return iter; - } + } else { + break; + } } if (!ec) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/12354 Trac 1.4.3