File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace csv {
88 namespace internals {
99 CSV_INLINE RawCSVField& CSVFieldList::operator [](size_t n) const {
1010 const size_t page_no = n / _single_buffer_capacity;
11- const size_t buffer_idx = (page_no < 1 ) ? n : n % _single_buffer_capacity;
11+ const size_t buffer_idx = n % _single_buffer_capacity;
1212 return this ->buffers .at (page_no)[buffer_idx];
1313 }
1414
Original file line number Diff line number Diff line change @@ -79,7 +79,12 @@ namespace csv {
7979
8080 // Recalculate _back pointer to point into OUR buffers, not the moved-from ones
8181 if (!this ->buffers .empty ()) {
82- _back = this ->buffers [_current_block].get () + _current_buffer_size;
82+ auto it = this ->buffers .find (_current_block);
83+ if (it != this ->buffers .end () && it->second ) {
84+ _back = it->second .get () + _current_buffer_size;
85+ } else {
86+ _back = nullptr ;
87+ }
8388 } else {
8489 _back = nullptr ;
8590 }
You can’t perform that action at this time.
0 commit comments