Skip to content

Commit

Permalink
snet
Browse files Browse the repository at this point in the history
-fix on error create net
  • Loading branch information
Tyill committed Jul 29, 2019
1 parent 79f84a5 commit 8d7effa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/skynet/src/snet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@ bool SNet::createNet(Net& inout_net, std::string& out_err){
OperatorBase* opr = SN_Opr::createOperator(this, n.second.oprName, n.first, n.second.oprPrms);

if (!opr){
for (auto& o : inout_net.operats)
SN_Opr::freeOperator(o.second, o.second->name());
out_err = "Error createNet: not found operator '" + n.second.oprName + "'";
inout_net.operats.clear();
return false;
}
inout_net.operats[n.first] = opr;
Expand Down Expand Up @@ -220,7 +221,7 @@ SNet::~SNet(){

if (engine_) delete engine_;

for (auto o : operats_)
for (auto& o : operats_)
SN_Opr::freeOperator(o.second, o.second->name());
}

Expand Down

0 comments on commit 8d7effa

Please sign in to comment.