From ea5200f5c01c976e191b8c03ef9bffcbc729bb87 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Thu, 16 Feb 2023 12:59:08 +0100
Subject: [PATCH] throw -> ASSERT

---
 GUI/Model/Sample/CoreAndShellItem.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/GUI/Model/Sample/CoreAndShellItem.cpp b/GUI/Model/Sample/CoreAndShellItem.cpp
index 74053181a0e..16b809eb01b 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())
-- 
GitLab