File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,9 +67,10 @@ persist() const
6767 auto p = std::allocate_shared<T>(
6868 detail::over_allocator<T, Alloc>(
6969 size (), a), url_view (impl ()));
70- std::memcpy (
71- reinterpret_cast <char *>(
72- p.get () + 1 ), data (), size ());
70+ if (size ())
71+ std::memcpy (
72+ reinterpret_cast <char *>(
73+ p.get () + 1 ), data (), size ());
7374 return p;
7475}
7576
Original file line number Diff line number Diff line change @@ -217,6 +217,16 @@ class url_view_test
217217 }
218218 }
219219
220+ // persist() with null data() and zero size()
221+ {
222+ url_view u;
223+ BOOST_TEST (u.empty ());
224+ auto sp = u.persist ();
225+ BOOST_TEST (sp->empty ());
226+ BOOST_TEST_EQ (sp->size (), 0u );
227+ BOOST_TEST_EQ (sp->buffer (), " " );
228+ }
229+
220230 // operator core::string_view()
221231 {
222232 auto const f = []( core::string_view ) {};
You can’t perform that action at this time.
0 commit comments