diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index a929f1e5d4d0104b9d511137fd7f5ea87d6e4307..9928812b352889ee92f596644f45a4e8f54f553c 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -325,7 +325,12 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, //THREAD=Main : for outgoing Call bool ManagerImpl::answerCall(const std::string& call_id) { - DEBUG("Answer call %s", call_id.c_str()); + Call *call = getCallFromCallID(call_id); + + if (call == NULL) { + ERROR("Call %s is NULL", call_id.c_str()); + return false; + } // If sflphone is ringing stopTone(); @@ -337,11 +342,6 @@ bool ManagerImpl::answerCall(const std::string& call_id) // store the current call id std::string current_call_id(getCurrentCallId()); - Call *call = getCallFromCallID(call_id); - - if (call == NULL) - ERROR("Call is NULL"); - // in any cases we have to detach from current communication if (hasCurrentCall()) { @@ -359,7 +359,9 @@ bool ManagerImpl::answerCall(const std::string& call_id) try { const std::string account_id = getAccountFromCall(call_id); - getAccountLink(account_id)->answer(call); + VoIPLink *link = getAccountLink(account_id); + if (link) + link->answer(call); } catch (const std::runtime_error &e) { ERROR("%s", e.what()); }