Ticket #7739: hash_map.hpp_patch

File hash_map.hpp_patch, 673 bytes (added by Gaurav Gupta <g.gupta@…>, 10 years ago)

Fix for the Divide by zero error in hash_map.hpp

Line 
1diff -Naur a/boost/asio/detail/hash_map.hpp b/boost/asio/detail/hash_map.hpp
2--- a/boost/asio/detail/hash_map.hpp 2012-01-15 19:16:25.000000000 +0530
3+++ b/boost/asio/detail/hash_map.hpp 2012-11-26 18:12:21.000000000 +0530
4@@ -181,6 +181,8 @@
5 void erase(iterator it)
6 {
7 BOOST_ASSERT(it != values_.end());
8+ if(0 == num_buckets_)
9+ return;
10
11 size_t bucket = calculate_hash_value(it->first) % num_buckets_;
12 bool is_first = (it == buckets_[bucket].first);
13@@ -244,6 +246,8 @@
14 if (num_buckets == num_buckets_)
15 return;
16 num_buckets_ = num_buckets;
17+ if(0 == num_buckets_)
18+ return;
19
20 iterator end_iter = values_.end();
21