mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-19 12:01:44 +00:00
Don't core-dump when asked to parse bad/non-existent document
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6b0fcf9cda
commit
aa02707b85
1 changed files with 27 additions and 25 deletions
|
@ -348,37 +348,39 @@ loader(const char *url, const char* eid, xmlParserCtxtPtr *ctxt)
|
||||||
- (id) initWithFileName: (NSString*)name
|
- (id) initWithFileName: (NSString*)name
|
||||||
{
|
{
|
||||||
self = [super initWithFileName: name];
|
self = [super initWithFileName: name];
|
||||||
|
if (self != nil)
|
||||||
mgr = RETAIN([NSFileManager defaultManager]);
|
|
||||||
refToFile = [NSMutableDictionary new];
|
|
||||||
contents = [NSMutableArray new];
|
|
||||||
footnotes = [NSMutableArray new];
|
|
||||||
if ([defs boolForKey: @"Monolithic"] == YES)
|
|
||||||
{
|
{
|
||||||
ASSIGN(currName, [baseName stringByAppendingPathExtension: @"html"]);
|
mgr = RETAIN([NSFileManager defaultManager]);
|
||||||
}
|
refToFile = [NSMutableDictionary new];
|
||||||
else
|
contents = [NSMutableArray new];
|
||||||
{
|
footnotes = [NSMutableArray new];
|
||||||
BOOL flag = NO;
|
if ([defs boolForKey: @"Monolithic"] == YES)
|
||||||
|
|
||||||
if ([mgr fileExistsAtPath: baseName isDirectory: &flag] == NO)
|
|
||||||
{
|
{
|
||||||
if ([mgr createDirectoryAtPath: baseName attributes: nil] == NO)
|
ASSIGN(currName, [baseName stringByAppendingPathExtension: @"html"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BOOL flag = NO;
|
||||||
|
|
||||||
|
if ([mgr fileExistsAtPath: baseName isDirectory: &flag] == NO)
|
||||||
{
|
{
|
||||||
NSLog(@"Unable to create directory '%@'", baseName);
|
if ([mgr createDirectoryAtPath: baseName attributes: nil] == NO)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to create directory '%@'", baseName);
|
||||||
|
RELEASE(self);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (flag == NO)
|
||||||
|
{
|
||||||
|
NSLog(@"The file '%@' is not a directory", baseName);
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
}
|
ASSIGN(currName,
|
||||||
else if (flag == NO)
|
[baseName stringByAppendingPathComponent: @"index.html"]);
|
||||||
{
|
}
|
||||||
NSLog(@"The file '%@' is not a directory", baseName);
|
}
|
||||||
RELEASE(self);
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
ASSIGN(currName,
|
|
||||||
[baseName stringByAppendingPathComponent: @"index.html"]);
|
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue