fix a bug in copy constructor of ParsedJson::iterator. (#146)

This commit is contained in:
Dong Xie 2019-04-22 08:37:02 -06:00 committed by Daniel Lemire
parent 49332d3e90
commit 1153778f92
2 changed files with 2 additions and 2 deletions

View File

@ -1618,7 +1618,7 @@ ParsedJson::iterator::iterator(const iterator &o):
current_val(o.current_val), depthindex(nullptr) { current_val(o.current_val), depthindex(nullptr) {
depthindex = new scopeindex_t[pj.depthcapacity]; depthindex = new scopeindex_t[pj.depthcapacity];
if(depthindex != nullptr) { if(depthindex != nullptr) {
memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0])); memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0]));
} else { } else {
tape_length = 0; tape_length = 0;
} }

View File

@ -34,7 +34,7 @@ ParsedJson::iterator::iterator(const iterator &o):
current_val(o.current_val), depthindex(nullptr) { current_val(o.current_val), depthindex(nullptr) {
depthindex = new scopeindex_t[pj.depthcapacity]; depthindex = new scopeindex_t[pj.depthcapacity];
if(depthindex != nullptr) { if(depthindex != nullptr) {
memcpy(o.depthindex, depthindex, pj.depthcapacity * sizeof(depthindex[0])); memcpy(depthindex, o.depthindex, pj.depthcapacity * sizeof(depthindex[0]));
} else { } else {
tape_length = 0; tape_length = 0;
} }