diff --git a/ChangeLog b/ChangeLog index 4667a6b20..17b05d787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 1.1.1 release + * fix crash in session::get_ip_filter when not having set one * fix filename escaping when repairing torrents with broken web seeds * fix bug where file_completed_alert would not be posted unless file_progress had been queries by the client diff --git a/src/session_impl.cpp b/src/session_impl.cpp index efd1ae0f4..33f0ddc6d 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1239,6 +1239,7 @@ namespace aux { ip_filter const& session_impl::get_ip_filter() { TORRENT_ASSERT(is_single_thread()); + if (!m_ip_filter) m_ip_filter = boost::make_shared(); return *m_ip_filter; } diff --git a/test/test_ip_filter.cpp b/test/test_ip_filter.cpp index 29aa50ea3..bdf6c252c 100644 --- a/test/test_ip_filter.cpp +++ b/test/test_ip_filter.cpp @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "test.hpp" #include "libtorrent/socket_io.hpp" +#include "libtorrent/session.hpp" /* @@ -89,6 +90,18 @@ void test_rules_invariant(std::vector > const& r, ip_filter const& f } } +TORRENT_TEST(session_get_ip_filter) +{ + using namespace libtorrent; + session ses; + ip_filter const& ipf = ses.get_ip_filter(); +#if TORRENT_USE_IPV6 + TEST_EQUAL(boost::get<0>(ipf.export_filter()).size(), 1); +#else + TEST_EQUAL(ipf.export_filter().size(), 1); +#endif +} + TORRENT_TEST(ip_filter) { using namespace libtorrent;