Description: Fix a crash when an invalid SIP domain is entered in the "Other SIP account" assistant
Author: Dennis Filder <d.filder@web.de>
Forwarded: TBD
Last-Update: 2022-10-07
--- a/linphone-app/src/components/assistant/AssistantModel.cpp
+++ b/linphone-app/src/components/assistant/AssistantModel.cpp
@@ -336,6 +336,10 @@
 	
 	
 	const QString domain = map["sipDomain"].toString();
+	if (domain.startsWith(QLatin1String("sip:"))) {
+		qWarning() << QStringLiteral("Field 'SIP Domain' must be a domain or host name (e.g. voip.example.org), not a URL: %1").arg(domain);
+		return nullptr;
+	}
 	
 	QString sipAddress = QStringLiteral("sip:%1@%2")
 			.arg(map["username"].toString()).arg(domain);
@@ -364,7 +368,7 @@
 	
 	// Sip Address.
 	shared_ptr<linphone::Address> address = factory->createAddress(Utils::appStringToCoreString(sipAddress));
-	if (!address) {
+	if (!address || address->asString().length() == 0) {
 		qWarning() << QStringLiteral("Unable to create sip address object from: `%1`.").arg(sipAddress);
 		return nullptr;
 	}
