Skip to content

Commit e725bcc

Browse files
committed
Prevents an exception
1 parent 5af1bbb commit e725bcc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ColorSetKit/NSColor+ColorSetKit.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ + ( nullable NSColor * )colorFromColorSet: ( NSString * )name
4949

5050
if( MainColorSet == nil )
5151
{
52-
MainColorSet = [ [ ColorSet alloc ] initWithPath: [ [ NSBundle mainBundle ] pathForResource: @"Colors" ofType: @"colorset" ] ];
52+
{
53+
NSString * path;
54+
55+
path = [ [ NSBundle mainBundle ] pathForResource: @"Colors" ofType: @"colorset" ];
56+
57+
if( path != nil && [ [ NSFileManager defaultManager ] fileExistsAtPath: path ] )
58+
{
59+
MainColorSet = [ [ ColorSet alloc ] initWithPath: path ];
60+
}
61+
}
5362
}
5463

5564
[ Lock unlock ];

0 commit comments

Comments
 (0)