Skip to content
Snippets Groups Projects
Commit f2b3e39b authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #21631: manager: don't answer fake calls

NULL Check calls before trying to answer them
parent 7c09d547
No related branches found
No related tags found
No related merge requests found
...@@ -325,7 +325,12 @@ bool ManagerImpl::outgoingCall(const std::string& account_id, ...@@ -325,7 +325,12 @@ bool ManagerImpl::outgoingCall(const std::string& account_id,
//THREAD=Main : for outgoing Call //THREAD=Main : for outgoing Call
bool ManagerImpl::answerCall(const std::string& call_id) 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 // If sflphone is ringing
stopTone(); stopTone();
...@@ -337,11 +342,6 @@ bool ManagerImpl::answerCall(const std::string& call_id) ...@@ -337,11 +342,6 @@ bool ManagerImpl::answerCall(const std::string& call_id)
// store the current call id // store the current call id
std::string current_call_id(getCurrentCallId()); 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 // in any cases we have to detach from current communication
if (hasCurrentCall()) { if (hasCurrentCall()) {
...@@ -359,7 +359,9 @@ bool ManagerImpl::answerCall(const std::string& call_id) ...@@ -359,7 +359,9 @@ bool ManagerImpl::answerCall(const std::string& call_id)
try { try {
const std::string account_id = getAccountFromCall(call_id); 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) { } catch (const std::runtime_error &e) {
ERROR("%s", e.what()); ERROR("%s", e.what());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment