diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
index f34e7549469..76b9601f05d 100644
--- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
+++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h
@@ -218,9 +218,12 @@ void Basic_sweep_line_2
::_init_structures()
{
CGAL_assertion(m_queue->empty());
CGAL_assertion((m_statusLine.size() == 0));
-
- // Allocate all of the Subcurve objects as one block.
- m_subCurves = m_subCurveAlloc.allocate(m_num_of_subCurves);
+
+ // Allocate all of the Subcurve objects as one block. Don't allocate
+ // anything when there are no subcurves.
+ if (m_num_of_subCurves > 0) {
+ m_subCurves = m_subCurveAlloc.allocate(m_num_of_subCurves);
+ }
return;
}