Merge pull request #8028 from nextcloud/backport/8027/stable-3.16

[stable-3.16] gui/macOS: Avoid UB in edge cases where there is no matching accountstate for a domain
This commit is contained in:
Matthieu Gallien 2025-03-14 16:38:57 +01:00 committed by GitHub
commit b234cd2e2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,6 +27,12 @@
#include "gui/accountmanager.h"
#include "libsync/account.h"
namespace OCC {
Q_LOGGING_CATEGORY(lcMacFileProviderDomainManager, "nextcloud.gui.macfileproviderdomainmanager", QtInfoMsg)
}
// Ensure that conversion to/from domain identifiers and display names
// are consistent throughout these classes
namespace {
@ -118,7 +124,8 @@ QString accountIdFromDomainId(NSString * const domainId)
return account->userIdAtHostWithPort();
}
}
Q_UNREACHABLE();
qCWarning(OCC::lcMacFileProviderDomainManager) << "Could not find account id for domain id:" << qDomainId;
return {};
}
API_AVAILABLE(macos(11.0))
@ -131,8 +138,6 @@ inline QString accountIdFromDomain(NSFileProviderDomain * const domain)
namespace OCC {
Q_LOGGING_CATEGORY(lcMacFileProviderDomainManager, "nextcloud.gui.macfileproviderdomainmanager", QtInfoMsg)
namespace Mac {
class API_AVAILABLE(macos(11.0)) FileProviderDomainManager::MacImplementation