diff --git a/src/vmime/net/serviceFactory.cpp b/src/vmime/net/serviceFactory.cpp index bbc9944a..b6f90eb2 100644 --- a/src/vmime/net/serviceFactory.cpp +++ b/src/vmime/net/serviceFactory.cpp @@ -60,7 +60,12 @@ shared_ptr serviceFactory::create (shared_ptr sess, const string& protocol, shared_ptr auth) { - return (getServiceByProtocol(protocol)->create(sess, auth)); + shared_ptr rserv = getServiceByProtocol(protocol); + + if (!rserv) + throw exceptions::no_factory_available("No service is registered for protocol '" + protocol + "'."); + + return rserv->create(sess, auth); }