Revision: 3059
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3059&view=rev
Author:   hofman
Date:     2007-10-23 02:55:09 -0700 (Tue, 23 Oct 2007)

Log Message:
-----------
Handle icon for missing files properly.

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

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2007-10-22 17:44:38 UTC (rev 3058)
+++ trunk/SKBookmark.m  2007-10-23 09:55:09 UTC (rev 3059)
@@ -61,19 +61,23 @@
         smallIcons = [[NSMutableDictionary alloc] init];
     
     NSString *extension = [filePath pathExtension];
+    if (extension == nil)
+        return nil;
+    
     NSImage *icon = [smallIcons objectForKey:extension];
     
     if (icon == nil) {
         NSImage *image = [[NSWorkspace sharedWorkspace] 
iconForFileType:extension];
-        NSRect sourceRect = {NSZeroPoint, [image size]};
-        NSRect targetRect = NSMakeRect(0.0, 0.0, 16.0, 16.0);
-        icon = [[NSImage alloc] initWithSize:targetRect.size];
-        [icon lockFocus];
-        [[NSGraphicsContext currentContext] 
setImageInterpolation:NSImageInterpolationHigh];
-        [image drawInRect:targetRect fromRect:sourceRect 
operation:NSCompositeCopy fraction:1.0];
-        [icon unlockFocus];
-        [smallIcons setObject:icon forKey:extension];
-        [icon release];
+        if (image) {NSRect sourceRect = {NSZeroPoint, [image size]};
+            NSRect targetRect = NSMakeRect(0.0, 0.0, 16.0, 16.0);
+            icon = [[NSImage alloc] initWithSize:targetRect.size];
+            [icon lockFocus];
+            [[NSGraphicsContext currentContext] 
setImageInterpolation:NSImageInterpolationHigh];
+            [image drawInRect:targetRect fromRect:sourceRect 
operation:NSCompositeCopy fraction:1.0];
+            [icon unlockFocus];
+            [smallIcons setObject:icon forKey:extension];
+            [icon release];
+        }
     }
     return icon;
 }


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

Reply via email to