fix a bug in copy constructor of ParsedJson::iterator. (#146)
This commit is contained in:
parent
49332d3e90
commit
1153778f92
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue