Skip to content

Commit

Permalink
quick fix for bug of negative index
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Nov 24, 2016
1 parent 19e085c commit 9235165
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/io/sparse_bin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ inline VAL_T SparseBinIterator<VAL_T>::InnerGet(data_size_t idx) {
while (cur_pos_ < idx && i_delta_ < bin_data_->num_vals_) {
bin_data_->NextNonzero(&i_delta_, &cur_pos_);
}
if (cur_pos_ == idx && i_delta_ < bin_data_->num_vals_) {
if (cur_pos_ == idx && i_delta_ < bin_data_->num_vals_ && i_delta_ >= 0) {
return bin_data_->vals_[i_delta_];
} else {
return 0;
Expand Down

0 comments on commit 9235165

Please sign in to comment.