Protect config from using contact if it doesn't exist while checking authentication

This commit is contained in:
Julien Wadel 2021-11-03 22:40:07 +01:00
parent f15a68d343
commit f736f110a6

View file

@ -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;
}
}
}