From 3428cd1177f3441cb537542e1a1fd7a2fc359e39 Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 20 Jan 2023 16:34:45 +0530 Subject: [PATCH] Session retrieval throws if the Session handling has not been initialized. --- src/Adapter.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Adapter.cc b/src/Adapter.cc index edde4be..8176002 100644 --- a/src/Adapter.cc +++ b/src/Adapter.cc @@ -109,9 +109,13 @@ namespace pEp { // public ::PEP_SESSION Session::operator()() { - if (!_session.get()) { + if(!_is_initialized) { throw std::runtime_error( - "libpEpAdapter: No session! Before use, call session.initialize() for each thread"); + "libpEpAdapter: No session! Before first use, call session::initialize()"); + } else { + if (!_session.get()) { + _new(); + } } return _session.get(); }