File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
include/nlohmann/detail/conversions Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -154,7 +154,10 @@ struct external_constructor<value_t::array>
154154 j.m_type = value_t ::array;
155155 j.m_value = value_t ::array;
156156 j.m_value .array ->resize (arr.size ());
157- std::copy (std::begin (arr), std::end (arr), j.m_value .array ->begin ());
157+ if (arr.size () > 0 )
158+ {
159+ std::copy (std::begin (arr), std::end (arr), j.m_value .array ->begin ());
160+ }
158161 j.assert_invariant ();
159162 }
160163};
Original file line number Diff line number Diff line change @@ -3489,7 +3489,10 @@ struct external_constructor<value_t::array>
34893489 j.m_type = value_t::array;
34903490 j.m_value = value_t::array;
34913491 j.m_value.array->resize(arr.size());
3492- std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
3492+ if (arr.size() > 0)
3493+ {
3494+ std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
3495+ }
34933496 j.assert_invariant();
34943497 }
34953498};
You can’t perform that action at this time.
0 commit comments