Revision: 3323
http://skim-app.svn.sourceforge.net/skim-app/?rev=3323&view=rev
Author: hofman
Date: 2007-12-08 09:58:16 -0800 (Sat, 08 Dec 2007)
Log Message:
-----------
Don't crash when a URL is attempted to be created with a nil string or path.
Unfortunately PDFKit has some bugs that to do this.
Modified Paths:
--------------
trunk/NSURL_SKExtensions.m
Modified: trunk/NSURL_SKExtensions.m
===================================================================
--- trunk/NSURL_SKExtensions.m 2007-12-08 13:12:20 UTC (rev 3322)
+++ trunk/NSURL_SKExtensions.m 2007-12-08 17:58:16 UTC (rev 3323)
@@ -37,11 +37,33 @@
*/
#import "NSURL_SKExtensions.h"
+#import "OBUtilities.h"
NSString *SKWeblocFilePboardType = @"CorePasteboardFlavorType 0x75726C20";
[EMAIL PROTECTED] NSURL (SKPrivateExtensions)
+- (id)replacementInitFileURLWithPath:(NSString *)path;
+- (id)replacementInitString:(NSString *)URLString;
[EMAIL PROTECTED]
+
@implementation NSURL (SKExtensions)
+static IMP originalInitFileURLWithPath = NULL;
+static IMP originalInitWithString = NULL;
+
++ (void)load {
+ originalInitFileURLWithPath =
OBReplaceMethodImplementationWithSelector(self,
@selector(initFileURLWithPath:), @selector(replacementInitFileURLWithPath:));
+ originalInitWithString = OBReplaceMethodImplementationWithSelector(self,
@selector(initWithString:), @selector(replacementInitString:));
+}
+
+- (id)replacementInitFileURLWithPath:(NSString *)path {
+ return path == nil ? nil : originalInitFileURLWithPath(self, _cmd, path);
+}
+
+- (id)replacementInitString:(NSString *)URLString {
+ return URLString == nil ? nil : originalInitWithString(self, _cmd,
URLString);
+}
+
+ (NSURL *)URLFromPasteboardAnyType:(NSPasteboard *)pasteboard {
NSString *pboardType = [pasteboard availableTypeFromArray:[NSArray
arrayWithObjects:SKWeblocFilePboardType, NSURLPboardType, NSStringPboardType,
nil]];
NSURL *theURL = nil;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit