Fixed out of array bound

pull/2/head
Tatsuhiro Tsujikawa 2011-11-08 00:15:37 +09:00
parent 02b3873e6d
commit f6f053cae1
1 changed files with 5 additions and 2 deletions

View File

@ -103,11 +103,14 @@ public:
T next()
{
T res;
if(index_ < segs_.size()) {
size_t len = segs_.size();
if(index_ < len) {
res = val_++;
if(val_ == segs_[index_].second) {
++index_;
val_ = segs_[index_].first;
if(index_ < len) {
val_ = segs_[index_].first;
}
}
} else {
res = 0;