Revision: 27320
          http://sourceforge.net/p/bibdesk/svn/27320
Author:   hofman
Date:     2022-03-24 17:10:02 +0000 (Thu, 24 Mar 2022)
Log Message:
-----------
Use enumeration method for dictionary

Modified Paths:
--------------
    trunk/bibdesk/BDSKMainTableView.m

Modified: trunk/bibdesk/BDSKMainTableView.m
===================================================================
--- trunk/bibdesk/BDSKMainTableView.m   2022-03-24 15:58:37 UTC (rev 27319)
+++ trunk/bibdesk/BDSKMainTableView.m   2022-03-24 17:10:02 UTC (rev 27320)
@@ -489,21 +489,20 @@
         
                NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc] 
initWithObjectsAndKeys:file, BDSKLocalUrlString, paperclip, 
BDSKLocalFileString, url, BDSKRemoteURLString, crossref, BDSKCrossrefString, 
color, BDSKColorString, color, BDSKColorLabelString, import, 
BDSKImportOrderString, doi, BDSKDoiString, citeseer, BDSKCiteseerUrlString, 
nil];
         NSDictionary *imagePaths = [[NSUserDefaults standardUserDefaults] 
objectForKey:BDSKTableHeaderImagesKey];
-               if (imagePaths) {
-                       NSImage *image;
-                       for (NSString *key in imagePaths) {
-                               NSString *imagePath = [imagePaths 
objectForKey:key];
+        [imagePaths enumerateKeysAndObjectsUsingBlock:^(NSString *key, 
NSString *imagePath, BOOL *stop){
+            if ([imagePath isKindOfClass:[NSString class]]) {
+                NSImage *image;
                 if ([imagePath isEqualToString:@""]) {
                     [tmpDict removeObjectForKey:key];
-                               } else if ([[NSFileManager defaultManager] 
fileExistsAtPath:imagePath] &&
-                                       (image = [[NSImage alloc] 
initWithContentsOfFile:imagePath])) {
+                } else if ([[NSFileManager defaultManager] 
fileExistsAtPath:imagePath] &&
+                    (image = [[NSImage alloc] 
initWithContentsOfFile:imagePath])) {
                     if ([[[imagePath lastPathComponent] 
stringByDeletingLastPathComponent] rangeOfString:@"Template" 
options:NSBackwardsSearch | NSAnchoredSearch].location != NSNotFound)
                         [image setTemplate:YES];
-                                       [tmpDict setObject:image forKey:key];
-                                       [image release];
-                               }
-                       }
-               }
+                    [tmpDict setObject:image forKey:key];
+                    [image release];
+                }
+            }
+        }];
         headerImageCache = [tmpDict copy];
         [tmpDict release];
        }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to