File tree 2 files changed +8
-2
lines changed
include/nlohmann/detail/conversions
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,10 @@ struct external_constructor<value_t::array>
174
174
j.m_type = value_t ::array;
175
175
j.m_value = value_t ::array;
176
176
j.m_value .array ->resize (arr.size ());
177
- std::copy (std::begin (arr), std::end (arr), j.m_value .array ->begin ());
177
+ if (arr.size () > 0 )
178
+ {
179
+ std::copy (std::begin (arr), std::end (arr), j.m_value .array ->begin ());
180
+ }
178
181
j.assert_invariant ();
179
182
}
180
183
};
Original file line number Diff line number Diff line change @@ -3516,7 +3516,10 @@ struct external_constructor<value_t::array>
3516
3516
j.m_type = value_t::array;
3517
3517
j.m_value = value_t::array;
3518
3518
j.m_value.array->resize(arr.size());
3519
- std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
3519
+ if (arr.size() > 0)
3520
+ {
3521
+ std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
3522
+ }
3520
3523
j.assert_invariant();
3521
3524
}
3522
3525
};
You can’t perform that action at this time.
0 commit comments