mail[Wesnoth-commits] r34224 - /trunk/src/unit_map.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by cjhopman on March 29, 2009 - 08:42:
Author: cjhopman
Date: Sun Mar 29 08:42:10 2009
New Revision: 34224

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34224&view=rev
Log:
- improve assert message when attempting to dereference invalid iterator

Modified:
    trunk/src/unit_map.hpp

Modified: trunk/src/unit_map.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_map.hpp?rev=34224&r1=34223&r2=34224&view=diff
==============================================================================
--- trunk/src/unit_map.hpp (original)
+++ trunk/src/unit_map.hpp Sun Mar 29 08:42:10 2009
@@ -110,8 +110,8 @@
                iterator_base() : policy_(), counter_(), map_(NULL), i_() { }
                iterator_base(iterator_type i, map_type* m) : policy_(i, m), 
counter_(m), map_(m), i_(i) { }
 
-               pointer_type operator->() const { assert(policy_.valid(i_, 
map_)); return i_->second.ptr_; }
-               reference_type operator*() const { assert(policy_.valid(i_, 
map_)); return *i_->second.ptr_; }
+               pointer_type operator->() const { assert(policy_.valid(i_, 
map_) && "Attempt to dereference invalid iterator"); return i_->second.ptr_; }
+               reference_type operator*() const { assert(policy_.valid(i_, 
map_) && "Attempt to dereference invalid iterator"); return *i_->second.ptr_; 
}
 
                iterator_base& operator++();
                iterator_base operator++(int);




Related Messages


Powered by MHonArc, Updated Sun Mar 29 09:40:27 2009