Do not set badge identifier for a given path URL if the URL is nil
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 29 Oct 2024 09:31:59 +0000 (17:31 +0800)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Tue, 19 Nov 2024 13:08:29 +0000 (14:08 +0100)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FinderSyncExt/FinderSync.m

index 822a2b6393846a5df9bb7b200931392909388d58..c21c3a9ac3f5b7fc8333a20fde23478cce0ded76 100644 (file)
 
 - (void)setResult:(NSString *)result forPath:(NSString*)path
 {
-       NSString *normalizedPath = [path decomposedStringWithCanonicalMapping];
-       [[FIFinderSyncController defaultController] setBadgeIdentifier:result forURL:[NSURL fileURLWithPath:normalizedPath]];
+    NSString *const normalizedPath = path.decomposedStringWithCanonicalMapping;
+    NSURL *const urlForPath = [NSURL fileURLWithPath:normalizedPath];
+    if (urlForPath == nil) {
+        return;
+    }
+    [FIFinderSyncController.defaultController setBadgeIdentifier:result forURL:urlForPath];
 }
 
 - (void)reFetchFileNameCacheForPath:(NSString*)path