From 58f2cad55506f890047858de235afbe777f26d37 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Mon, 4 Dec 2023 10:54:04 +0100 Subject: [PATCH] ASSERT -> throw, as wrong input does happen --- Resample/Processed/ReSample.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Resample/Processed/ReSample.cpp b/Resample/Processed/ReSample.cpp index eb76a376dea..2a59fef8058 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; -- GitLab