diff --git a/GUI/Model/Sample/CoreAndShellItem.cpp b/GUI/Model/Sample/CoreAndShellItem.cpp index 74053181a0ef89432e9b7731e2ffff3bcb090ceb..16b809eb01b69554856ca569bf6b155baffee3fd 100644 --- a/GUI/Model/Sample/CoreAndShellItem.cpp +++ b/GUI/Model/Sample/CoreAndShellItem.cpp @@ -13,6 +13,7 @@ // ************************************************************************************************ #include "GUI/Model/Sample/CoreAndShellItem.h" +#include "Base/Util/Assert.h" #include "GUI/Model/Sample/MaterialModel.h" #include "GUI/Model/Sample/ParticleItem.h" #include "GUI/Support/Type/VariantUtil.h" @@ -131,15 +132,14 @@ void CoreAndShellItem::readFrom(QXmlStreamReader* r) std::unique_ptr<CoreAndShell> CoreAndShellItem::createCoreAndShell() const { - std::unique_ptr<Particle> P_core{}; - std::unique_ptr<Particle> P_shell{}; - if (m_core) - P_core = m_core->createParticle(); - if (m_shell) - P_shell = m_shell->createParticle(); - if (!P_core || !P_shell) - throw Error("CoreAndShellItem::createCoreAndShell -> Error. Either " - "core or shell particle is undefined."); + ASSERT(m_core); + std::unique_ptr<Particle> P_core = m_core->createParticle(); + ASSERT(P_core); + + ASSERT(m_shell); + std::unique_ptr<Particle> P_shell = m_shell->createParticle(); + ASSERT(P_shell); + auto P_coreshell = std::make_unique<CoreAndShell>(*P_shell, *P_core); P_coreshell->setAbundance(abundance()); if (auto r = createRotation(); r && !r->isIdentity())