Skip to content
Snippets Groups Projects
Commit 3ee69e8e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

no 'else' after 'return'; ASSERT, not throw, in impossible cases

parent 22e82fb1
No related branches found
No related tags found
1 merge request!226Annotations to GUIDomainSampleVisitor and other copy edits
Pipeline #41991 passed
...@@ -570,10 +570,8 @@ ExternalProperty GUIDomainSampleVisitor::createMaterialFromDomain(const Material ...@@ -570,10 +570,8 @@ ExternalProperty GUIDomainSampleVisitor::createMaterialFromDomain(const Material
} else if (material->typeID() == MATERIAL_TYPES::MaterialBySLD) { } else if (material->typeID() == MATERIAL_TYPES::MaterialBySLD) {
mat_item = m_materialModel->addSLDMaterial(materialName, material_data.real(), mat_item = m_materialModel->addSLDMaterial(materialName, material_data.real(),
material_data.imag()); material_data.imag());
} else { } else
throw Error("GUI::Model::ObjectBuilder::createMaterialFromDomain() -> Error. " ASSERT(0);
"Unsupported material");
}
mat_item->setMagnetization(material->magnetization()); mat_item->setMagnetization(material->magnetization());
return GUI::Model::MaterialItemUtils::materialProperty(*mat_item); return GUI::Model::MaterialItemUtils::materialProperty(*mat_item);
...@@ -598,16 +596,13 @@ ParticleItem* GUIDomainSampleVisitor::CreateIParticle(SessionItem* parent, ...@@ -598,16 +596,13 @@ ParticleItem* GUIDomainSampleVisitor::CreateIParticle(SessionItem* parent,
dynamic_cast<const ParticleCoreShell*>(m_itemToSample[parent]); dynamic_cast<const ParticleCoreShell*>(m_itemToSample[parent]);
ASSERT(coreshell); ASSERT(coreshell);
ParticleCoreShellItem* parentCoreShell = polymorphic_cast<ParticleCoreShellItem*>(parent); ParticleCoreShellItem* parentCoreShell = polymorphic_cast<ParticleCoreShellItem*>(parent);
if (particle == coreshell->coreParticle()) { if (particle == coreshell->coreParticle())
return parentCoreShell->createCore(); return parentCoreShell->createCore();
} else if (particle == coreshell->shellParticle()) { if (particle == coreshell->shellParticle())
return parentCoreShell->createShell(); return parentCoreShell->createShell();
} else { ASSERT(0);
throw Error("GUI::Model::ObjectBuilder::InsertIParticle:" }
"Particle not found in parent ParticleCoreShell"); return m_sampleModel->insertItem<ParticleItem>(parent, -1);
}
} else
return m_sampleModel->insertItem<ParticleItem>(parent, -1);
} }
// Used only in this file // Used only in this file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment