Revision: 5019
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5019&view=rev
Author:   hofman
Date:     2008-12-02 11:09:56 +0000 (Tue, 02 Dec 2008)

Log Message:
-----------
make sure we don't use a nil template string value

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

Modified: trunk/SKTemplateParser.m
===================================================================
--- trunk/SKTemplateParser.m    2008-12-02 10:47:11 UTC (rev 5018)
+++ trunk/SKTemplateParser.m    2008-12-02 11:09:56 UTC (rev 5019)
@@ -434,7 +434,7 @@
             if (type == SKValueTemplateTagType) {
                 
                 if (keyValue)
-                    [result appendString:[keyValue templateStringValue]];
+                    [result appendString:[keyValue templateStringValue] ?: 
@""];
                 
             } else if (type == SKCollectionTemplateTagType) {
                 
@@ -469,16 +469,16 @@
                     }
                     switch ([tag matchType]) {
                         case SKTemplateTagMatchEqual:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
caseInsensitiveCompare:matchString] == NSOrderedSame;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
caseInsensitiveCompare:matchString] == NSOrderedSame;
                             break;
                         case SKTemplateTagMatchContain:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
                             break;
                         case SKTemplateTagMatchSmaller:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
+                            isMatch = [matchString isEqualToString:@""] ? NO : 
[[keyValue templateStringValue] ?: @"" 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
                             break;
                         case SKTemplateTagMatchSmallerOrEqual:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
                             break;
                         default:
                             isMatch = [keyValue isNotEmpty];
@@ -786,16 +786,16 @@
                     }
                     switch ([tag matchType]) {
                         case SKTemplateTagMatchEqual:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
caseInsensitiveCompare:matchString] == NSOrderedSame;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
caseInsensitiveCompare:matchString] == NSOrderedSame;
                             break;
                         case SKTemplateTagMatchContain:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
rangeOfString:matchString options:NSCaseInsensitiveSearch].location != 
NSNotFound;
                             break;
                         case SKTemplateTagMatchSmaller:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
+                            isMatch = [matchString isEqualToString:@""] ? NO : 
[[keyValue templateStringValue] ?: @"" 
localizedCaseInsensitiveNumericCompare:matchString] == NSOrderedAscending;
                             break;
                         case SKTemplateTagMatchSmallerOrEqual:
-                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
+                            isMatch = [matchString isEqualToString:@""] ? NO 
== [keyValue isNotEmpty] : [[keyValue templateStringValue] ?: @"" 
localizedCaseInsensitiveNumericCompare:matchString] != NSOrderedDescending;
                             break;
                         default:
                             isMatch = [keyValue isNotEmpty];
@@ -870,7 +870,7 @@
 }
 
 - (NSAttributedString 
*)templateAttributedStringValueWithAttributes:(NSDictionary *)attributes {
-    return [[[NSAttributedString alloc] initWithString:[self 
templateStringValue] attributes:attributes] autorelease];
+    return [[[NSAttributedString alloc] initWithString:[self 
templateStringValue] ?: @"" attributes:attributes] autorelease];
 }
 
 @end


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 the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to