diff --git a/Resample/Processed/ReSample.cpp b/Resample/Processed/ReSample.cpp index eb76a376dea3e1620a0aa00f286b3469d4ff269a..2a59fef8058cdfbca83933b5cbbb867c2f839ab0 100644 --- a/Resample/Processed/ReSample.cpp +++ b/Resample/Processed/ReSample.cpp @@ -35,6 +35,7 @@ #include "Sample/Particle/IParticle.h" #include <iomanip> #include <iostream> +#include <stdexcept> namespace { @@ -241,8 +242,11 @@ ReLayout* makeReLayout(const ParticleLayout& layout, const SliceStack& slices, d const SimulationOptions& options, bool polarized) { const double layout_abundance = layout.totalAbundance(); - ASSERT(layout_abundance > 0); + if (layout_abundance <= 0) + throw std::runtime_error("Particle layout has invalid total abundance <= 0"); const double surface_density = layout.totalParticleSurfaceDensity(); + if (surface_density <= 0) + throw std::runtime_error("Particle layout has invalid surface density <= 0"); OwningVector<const CoheringSubparticles> coherentParticles;