From 9060d1efd27374d293443523c8e8f9cdea8a0a22 Mon Sep 17 00:00:00 2001 From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Thu, 4 Mar 2010 18:50:15 +0000 Subject: [PATCH] throw error when trying to insert already existing chain git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1764 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/mol/base/src/impl/entity_impl.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mol/base/src/impl/entity_impl.cc b/modules/mol/base/src/impl/entity_impl.cc index ebd7a346b..096db3cee 100644 --- a/modules/mol/base/src/impl/entity_impl.cc +++ b/modules/mol/base/src/impl/entity_impl.cc @@ -382,6 +382,11 @@ ResidueImplPtr EntityImpl::CreateResidue(const ChainImplPtr& cp, ChainImplPtr EntityImpl::InsertChain(const String& cname) { + ChainImplMap::iterator i=chain_map_.find(cname); + if (i!=chain_map_.end()) { + throw IntegrityError("Can't insert chain. A chain with name '"+cname+ + "' already exists"); + } #if MAKE_SHARED_AVAILABLE ChainImplPtr cp=boost::make_shared<ChainImpl>(shared_from_this(), cname); #else -- GitLab