From f736f110a6da99309fab318a80956fdb47dbc667 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 3 Nov 2021 22:40:07 +0100 Subject: [PATCH] Protect config from using contact if it doesn't exist while checking authentication --- linphone-app/src/components/core/CoreHandlers.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/linphone-app/src/components/core/CoreHandlers.cpp b/linphone-app/src/components/core/CoreHandlers.cpp index b419ae38f..bcd3a2912 100644 --- a/linphone-app/src/components/core/CoreHandlers.cpp +++ b/linphone-app/src/components/core/CoreHandlers.cpp @@ -60,10 +60,14 @@ void CoreHandlers::onAuthenticationRequested ( auto config = configList.begin() ; std::string username = authInfo->getUsername(); std::string domain = authInfo->getDomain(); - while(config != configList.end() && ((*config)->getContact()->getUsername() != username || (*config)->getContact()->getDomain() != domain)) - ++config; - if( config != configList.end() ) - emit authenticationRequested(authInfo);// Send authentification request only if a proxy still exists + while(config != configList.end()) { + auto contact = (*config)->getContact(); + if( contact && contact->getUsername() == username && (*config)->getContact()->getDomain() == domain) { + emit authenticationRequested(authInfo);// Send authentification request only if a proxy still exists + return; + }else + ++config; + } } }