From 9078a085c3b3e0035506c764f6cef06032c0148e Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 20 Jan 2018 16:19:13 +0000 Subject: [PATCH] Kill exception if removeDelegate fails This simplifies logic when changing the package::Root --- simgear/package/Root.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/simgear/package/Root.cxx b/simgear/package/Root.cxx index ec167000..a0918525 100644 --- a/simgear/package/Root.cxx +++ b/simgear/package/Root.cxx @@ -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); } - d->delegates.erase(it); } void Root::setLocale(const std::string& aLocale)