From: Claudio Cambra Date: Tue, 15 Oct 2024 03:30:54 +0000 (+0800) Subject: Fix crash caused by null accountstate due to bad domain identifier parsed from FPExt X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~58^2^2~119^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=14a9382772e00122f1537855c9549ee76a0e3519;p=nextcloud-desktop.git Fix crash caused by null accountstate due to bad domain identifier parsed from FPExt Turns out since we are forced to replace colons with hyphens we need to replace them back to colons when we receive the domain identifier from the file provider extension. If we do not then we get a null accountState pointer in the socket controller and this causes a crash Signed-off-by: Claudio Cambra --- diff --git a/src/gui/macOS/fileprovidersocketcontroller.cpp b/src/gui/macOS/fileprovidersocketcontroller.cpp index dad2032b5..44fca50f2 100644 --- a/src/gui/macOS/fileprovidersocketcontroller.cpp +++ b/src/gui/macOS/fileprovidersocketcontroller.cpp @@ -86,7 +86,19 @@ void FileProviderSocketController::parseReceivedLine(const QString &receivedLine const auto argument = receivedLine.mid(argPos + 1); if (command == QStringLiteral("FILE_PROVIDER_DOMAIN_IDENTIFIER_REQUEST_REPLY")) { - _accountState = FileProviderDomainManager::accountStateFromFileProviderDomainIdentifier(argument); + auto domainIdentifier = argument; + // Check if we have a port number who's colon has been replaced by a hyphen + // This is a workaround for the fact that we can't use colons as characters in domain names + // Let's check if, after the final hyphen, we have a number -- then it is a port number + const auto portColonPos = argument.lastIndexOf('-'); + const auto possiblePort = argument.mid(portColonPos + 1); + auto validInt = false; + const auto port = possiblePort.toInt(&validInt); + if (validInt && port > 0) { + domainIdentifier.replace(portColonPos, 1, ':'); + } + + _accountState = FileProviderDomainManager::accountStateFromFileProviderDomainIdentifier(domainIdentifier); sendAccountDetails(); reportSyncState("SYNC_PREPARING"); return;