Don't get range from nil

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-04-24 17:34:06 +00:00
parent efaef5b924
commit d9807b8983

View file

@ -1185,8 +1185,10 @@ static BOOL snuggleStart(NSString *t)
unitName = name; unitName = name;
} }
if (comment != nil)
{
r = [comment rangeOfString: @"<standards>"]; r = [comment rangeOfString: @"<standards>"];
if (comment != nil && r.length > 0) if (r.length > 0)
{ {
unsigned i = r.location; unsigned i = r.location;
@ -1210,6 +1212,7 @@ static BOOL snuggleStart(NSString *t)
NSLog(@"unterminated <standards> in comment for %@", name); NSLog(@"unterminated <standards> in comment for %@", name);
} }
} }
}
if (standards == nil) if (standards == nil)
{ {
standards = [d objectForKey: @"Standards"]; standards = [d objectForKey: @"Standards"];
@ -1219,8 +1222,10 @@ static BOOL snuggleStart(NSString *t)
* Make sure we have a 'unit' part and a class 'desc' part (comment) * Make sure we have a 'unit' part and a class 'desc' part (comment)
* to be output. * to be output.
*/ */
if (comment != nil)
{
r = [comment rangeOfString: @"<unit>"]; r = [comment rangeOfString: @"<unit>"];
if (comment != nil && r.length > 0) if (r.length > 0)
{ {
unsigned pos = r.location; unsigned pos = r.location;
@ -1261,7 +1266,9 @@ static BOOL snuggleStart(NSString *t)
stringByAppendingString: [comment substringFromIndex: end]]; stringByAppendingString: [comment substringFromIndex: end]];
} }
} }
unit = [unit stringByReplacingString: @"unit>" withString: @"chapter>"]; unit = [unit stringByReplacingString: @"unit>"
withString: @"chapter>"];
}
} }
else else
{ {