Fix some crashes because of nil content

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_6_0@16086 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-02-27 21:25:09 +00:00
parent a68f798dbc
commit eab5a2efe6
3 changed files with 30 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2003-02-27 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSIndex.m: Convert nil content to empty strings before use.
* Tools/AGSHtml.m: ditto ... prevent some crashes.
2003-02-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProcessInfo.m (_gnu_process_args): Tidied patch and add

View file

@ -775,6 +775,7 @@ static NSMutableSet *textNodes = nil;
if (val == nil)
{
val = text;
if (val == nil) val = @"";
}
[buf appendString: [self makeAnchor: val ofType: @"label" name: @""]];
}
@ -844,6 +845,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
@ -1180,6 +1182,7 @@ static NSMutableSet *textNodes = nil;
if (val == nil)
{
val = text;
if (val == nil) val = @"";
}
[buf appendString:
[self makeAnchor: val ofType: @"label" name: text]];
@ -1219,6 +1222,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
@ -1333,6 +1337,7 @@ static NSMutableSet *textNodes = nil;
{
NSString *content = [t content];
if (content == nil) content = @"";
sel = [sel stringByAppendingString: content];
if (hadArg == YES)
{
@ -1356,7 +1361,10 @@ static NSMutableSet *textNodes = nil;
{
if ([t type] == XML_TEXT_NODE)
{
str = [str stringByAppendingString: [t content]];
NSString *content = [t content];
if (content == nil) content = @"";
str = [str stringByAppendingString: content];
}
t = [t next];
}
@ -1991,6 +1999,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
{
NSString *str = [node content];
if (str == nil) str = @"";
[buf appendString: str];
}
else if ([node type] == XML_ENTITY_REF_NODE)
@ -2043,6 +2052,7 @@ NSLog(@"Element '%@' not implemented", name); // FIXME
{
NSString *text = [[node firstChild] content];
if (text == nil) text = @"";
[buf appendString: indent];
[buf appendString: @"<dd>"];
[buf appendString: [self protocolRef: text]];

View file

@ -274,6 +274,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
{
NSMutableDictionary *d;
NSString *k;
NSString *c;
d = [refs objectForKey: @"contents"];
if (d == nil)
@ -285,7 +286,9 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
k = [NSString stringWithFormat: @"%03u%03u%03u%03u",
chap, sect, ssect, sssect];
[d setObject: [[children content] stringByTrimmingSpaces] forKey: k];
c = [[children content] stringByTrimmingSpaces];
if (c == nil) c = @"";
[d setObject: c forKey: k];
children = nil;
}
else if ([name isEqual: @"ivariable"] == YES)
@ -303,6 +306,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
NSString *val;
text = [[children content] stringByTrimmingSpaces];
if (text == nil) text = @"";
children = nil;
all = [refs objectForKey: name];
if (all == nil)
@ -352,8 +356,11 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
{
if ([t type] == XML_TEXT_NODE)
{
sel = [sel stringByAppendingString:
[[t content] stringByTrimmingSpaces]];
NSString *s;
s = [[t content] stringByTrimmingSpaces];
if (s == nil) s = @"";
sel = [sel stringByAppendingString: s];
}
t = [t next];
}
@ -416,6 +423,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
else if ([name isEqual: @"title"] == YES)
{
NSMutableDictionary *d;
NSString *s;
d = [refs objectForKey: @"title"];
if (d == nil)
@ -425,8 +433,9 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
RELEASE(d);
}
[d setObject: [[children content] stringByTrimmingSpaces]
forKey: base];
s = [[children content] stringByTrimmingSpaces];
if (s == nil) s = @"";
[d setObject: s forKey: base];
children = nil;
}
else