Revision: 3057
http://skim-app.svn.sourceforge.net/skim-app/?rev=3057&view=rev
Author: hofman
Date: 2007-10-22 09:44:13 -0700 (Mon, 22 Oct 2007)
Log Message:
-----------
Make sure we won't add invalid bookmarks.
Modified Paths:
--------------
trunk/SKBookmark.m
trunk/SKBookmarkController.m
Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m 2007-10-22 12:24:58 UTC (rev 3056)
+++ trunk/SKBookmark.m 2007-10-22 16:44:13 UTC (rev 3057)
@@ -80,11 +80,16 @@
- (id)initWithAlias:(BDAlias *)anAlias pageIndex:(unsigned)aPageIndex
label:(NSString *)aLabel {
if (self = [super init]) {
- bookmarkType = SKBookmarkTypeBookmark;
- alias = [anAlias retain];
- pageIndex = aPageIndex;
- label = [aLabel copy];
- children = nil;
+ if (anAlias) {
+ bookmarkType = SKBookmarkTypeBookmark;
+ alias = [anAlias retain];
+ pageIndex = aPageIndex;
+ label = [aLabel copy];
+ children = nil;
+ } else {
+ [self release];
+ self = nil;
+ }
}
return self;
}
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2007-10-22 12:24:58 UTC (rev 3056)
+++ trunk/SKBookmarkController.m 2007-10-22 16:44:13 UTC (rev 3057)
@@ -111,7 +111,8 @@
while (dict = [dictEnum nextObject]) {
SKBookmark *bookmark = [[SKBookmark alloc]
initWithDictionary:dict];
- [bookmarks addObject:bookmark];
+ if (bookmark)
+ [bookmarks addObject:bookmark];
[bookmark release];
}
}
@@ -211,10 +212,9 @@
}
- (void)addBookmarkForPath:(NSString *)path pageIndex:(unsigned)pageIndex
label:(NSString *)label {
- if (path == nil)
- return;
SKBookmark *bookmark = [[SKBookmark alloc] initWithPath:path
pageIndex:pageIndex label:label];
- [[self mutableArrayValueForKey:@"bookmarks"] addObject:bookmark];
+ if (bookmark)
+ [[self mutableArrayValueForKey:@"bookmarks"] addObject:bookmark];
[bookmark release];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit