mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:31:56 +00:00
Skip initial view controller if it doesn't exist
This commit is contained in:
parent
43feefce68
commit
7850f8e61b
2 changed files with 77 additions and 58 deletions
|
@ -612,10 +612,14 @@
|
||||||
if ([docNodes count] > 0)
|
if ([docNodes count] > 0)
|
||||||
{
|
{
|
||||||
NSXMLElement *docNode = [docNodes objectAtIndex: 0];
|
NSXMLElement *docNode = [docNodes objectAtIndex: 0];
|
||||||
|
|
||||||
|
if (docNode != nil)
|
||||||
|
{
|
||||||
NSArray *array = [docNode nodesForXPath: @"//scene" error: NULL];
|
NSArray *array = [docNode nodesForXPath: @"//scene" error: NULL];
|
||||||
NSArray *firstResponderIdNodes = [docNode nodesForXPath: @"//objects/customObject[@sceneMemberID =\"firstResponder\"]/@id"
|
NSArray *firstResponderIdNodes = [docNode nodesForXPath: @"//objects/customObject[@sceneMemberID =\"firstResponder\"]/@id"
|
||||||
error: NULL];
|
error: NULL];
|
||||||
NSString *firstResponderId = @"-1";
|
NSString *firstResponderId = @"-1";
|
||||||
|
NSXMLNode *initialViewControllerNode = [docNode attributeForName: @"initialViewController"];
|
||||||
|
|
||||||
if([firstResponderIdNodes count] > 0)
|
if([firstResponderIdNodes count] > 0)
|
||||||
{
|
{
|
||||||
|
@ -623,7 +627,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set initial view controller...
|
// Set initial view controller...
|
||||||
|
if (initialViewControllerNode != nil)
|
||||||
|
{
|
||||||
ASSIGN(_initialViewControllerId, [[docNode attributeForName: @"initialViewController"] stringValue]);
|
ASSIGN(_initialViewControllerId, [[docNode attributeForName: @"initialViewController"] stringValue]);
|
||||||
|
}
|
||||||
|
|
||||||
FOR_IN(NSXMLElement*, e, array)
|
FOR_IN(NSXMLElement*, e, array)
|
||||||
{
|
{
|
||||||
NSXMLElement *doc = [[NSXMLElement alloc] initWithName: @"document"];
|
NSXMLElement *doc = [[NSXMLElement alloc] initWithName: @"document"];
|
||||||
|
@ -676,6 +684,12 @@
|
||||||
format: @"No document element found in storyboard file"];
|
format: @"No document element found in storyboard file"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[NSException raise: NSInternalInconsistencyException
|
||||||
|
format: @"Document node returned nil"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL) isProcessedDocument: (NSXMLDocument *)xmlIn
|
- (BOOL) isProcessedDocument: (NSXMLDocument *)xmlIn
|
||||||
{
|
{
|
||||||
|
|
|
@ -163,11 +163,16 @@ static NSStoryboard *__mainStoryboard = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier
|
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier
|
||||||
|
{
|
||||||
|
if (identifier != nil)
|
||||||
{
|
{
|
||||||
return [self instantiateControllerWithIdentifier: identifier
|
return [self instantiateControllerWithIdentifier: identifier
|
||||||
creator: nil];
|
creator: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier
|
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier
|
||||||
creator: (NSStoryboardControllerCreator)block
|
creator: (NSStoryboardControllerCreator)block
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue