mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-19 03:51:38 +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
|
||||
{
|
||||
self = [super initWithFileName: name];
|
||||
|
||||
mgr = RETAIN([NSFileManager defaultManager]);
|
||||
refToFile = [NSMutableDictionary new];
|
||||
contents = [NSMutableArray new];
|
||||
footnotes = [NSMutableArray new];
|
||||
if ([defs boolForKey: @"Monolithic"] == YES)
|
||||
if (self != nil)
|
||||
{
|
||||
ASSIGN(currName, [baseName stringByAppendingPathExtension: @"html"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL flag = NO;
|
||||
|
||||
if ([mgr fileExistsAtPath: baseName isDirectory: &flag] == NO)
|
||||
mgr = RETAIN([NSFileManager defaultManager]);
|
||||
refToFile = [NSMutableDictionary new];
|
||||
contents = [NSMutableArray new];
|
||||
footnotes = [NSMutableArray new];
|
||||
if ([defs boolForKey: @"Monolithic"] == YES)
|
||||
{
|
||||
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);
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
else if (flag == NO)
|
||||
{
|
||||
NSLog(@"The file '%@' is not a directory", baseName);
|
||||
RELEASE(self);
|
||||
return nil;
|
||||
}
|
||||
ASSIGN(currName,
|
||||
[baseName stringByAppendingPathComponent: @"index.html"]);
|
||||
}
|
||||
ASSIGN(currName,
|
||||
[baseName stringByAppendingPathComponent: @"index.html"]);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue