Kill exception if removeDelegate fails

This simplifies logic when changing the package::Root
This commit is contained in:
James Turner 2018-01-20 16:19:13 +00:00
parent 8a128a57cd
commit 9078a085c3

View File

@ -554,12 +554,10 @@ void Root::addDelegate(simgear::pkg::Delegate *aDelegate)
void Root::removeDelegate(simgear::pkg::Delegate *aDelegate)
{
DelegateVec::iterator it = std::find(d->delegates.begin(),
d->delegates.end(), aDelegate);
if (it == d->delegates.end()) {
throw sg_exception("unknown delegate in removeDelegate");
}
auto it = std::find(d->delegates.begin(), d->delegates.end(), aDelegate);
if (it != d->delegates.end()) {
d->delegates.erase(it);
}
}
void Root::setLocale(const std::string& aLocale)