Revision: 6914
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6914&view=rev
Author:   hofman
Date:     2010-12-01 18:48:56 +0000 (Wed, 01 Dec 2010)

Log Message:
-----------
don't crash when getting invalid bookmark data, log problems

Modified Paths:
--------------
    trunk/SKBookmark.m
    trunk/SKBookmarkController.m

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2010-12-01 00:54:36 UTC (rev 6913)
+++ trunk/SKBookmark.m  2010-12-01 18:48:56 UTC (rev 6914)
@@ -358,8 +358,13 @@
     } else if ([type isEqualToString:FOLDER_STRING] || [type 
isEqualToString:SESSION_STRING]) {
         Class bookmarkClass = [type isEqualToString:FOLDER_STRING] ? 
[SKFolderBookmark class] : [SKSessionBookmark class];
         NSMutableArray *newChildren = [NSMutableArray array];
-        for (NSDictionary *dict in [dictionary objectForKey:CHILDREN_KEY])
-            [newChildren addObject:[SKBookmark bookmarkWithProperties:dict]];
+        SKBookmark *child;
+        for (NSDictionary *dict in [dictionary objectForKey:CHILDREN_KEY]) {
+            if (child = [SKBookmark bookmarkWithProperties:dict])
+                [newChildren addObject:child];
+            else
+                NSLog(@"Failed to read child bookmark: %@", dict);
+        }
         return [[bookmarkClass alloc] initFolderWithChildren:newChildren 
label:[dictionary objectForKey:LABEL_KEY]];
     } else if ([dictionary objectForKey:@"windowFrame"]) {
         return [[SKFileBookmark alloc] initWithSetup:dictionary 
label:[dictionary objectForKey:LABEL_KEY]];
@@ -475,7 +480,10 @@
 }
 
 - (NSData *)aliasData {
-    return [self path] ? [alias aliasData] : aliasData;
+    NSData *data = nil;
+    if ([self path])
+        data = [alias aliasData];
+    return data ?: aliasData;
 }
 
 - (NSImage *)icon {

Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m        2010-12-01 00:54:36 UTC (rev 6913)
+++ trunk/SKBookmarkController.m        2010-12-01 18:48:56 UTC (rev 6914)
@@ -133,6 +133,8 @@
                     SKBookmark *bookmark = [SKBookmark 
bookmarkWithProperties:dict];
                     if (bookmark)
                         [bookmarks addObject:bookmark];
+                    else
+                        NSLog(@"Failed to read bookmark: %@", dict);
                 }
             }
             


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

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to