Skip to content

Commit 14ac99d

Browse files
committed
update
1 parent e0cd860 commit 14ac99d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/lib_json/json_value.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1180,12 +1180,11 @@ bool Value::insert(ArrayIndex index, Value&& newValue) {
11801180
if (type() != arrayValue) {
11811181
return false;
11821182
}
1183-
ArrayIndex oldsize = size();
1184-
if (index > oldsize) {
1183+
ArrayIndex length = size();
1184+
if (index > length) {
11851185
append(std::move(newValue));
11861186
return true;
11871187
} else {
1188-
ArrayIndex length = size();
11891188
for (ArrayIndex i = length; i > index; i--) {
11901189
(*this)[i] = std::move((*this)[i - 1]);
11911190
}

src/test_lib_json/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ JSONTEST_FIXTURE(IteratorTest, const) {
25302530
Json::Value const v;
25312531
JSONTEST_ASSERT_THROWS(
25322532
Json::Value::iterator it(v.begin()) // Compile, but throw.
2533-
);
2533+
);
25342534

25352535
Json::Value value;
25362536

0 commit comments

Comments
 (0)