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 @@ -154,7 +154,10 @@ struct external_constructor<value_t::array>
154
154
j.m_type = value_t ::array;
155
155
j.m_value = value_t ::array;
156
156
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
+ }
158
161
j.assert_invariant ();
159
162
}
160
163
};
Original file line number Diff line number Diff line change @@ -3489,7 +3489,10 @@ struct external_constructor<value_t::array>
3489
3489
j.m_type = value_t::array;
3490
3490
j.m_value = value_t::array;
3491
3491
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
+ }
3493
3496
j.assert_invariant();
3494
3497
}
3495
3498
};
You can’t perform that action at this time.
0 commit comments