Raise an exception in init methods when called with nil nib file name

or nil owner


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11087 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2001-10-06 13:27:46 +00:00
parent 1b792f83c7
commit cd967093fd

View file

@ -34,7 +34,19 @@
- (id) initWithWindowNibName: (NSString *)windowNibName owner: (id)owner - (id) initWithWindowNibName: (NSString *)windowNibName owner: (id)owner
{ {
[self initWithWindow: nil]; if (windowNibName == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to init NSWindowController with nil windowNibName"];
}
if (owner == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"attempt to init NSWindowController with nil owner"];
}
self = [self initWithWindow: nil];
ASSIGN (_windowNibName, windowNibName); ASSIGN (_windowNibName, windowNibName);
_owner = owner; _owner = owner;
return self; return self;
@ -42,7 +54,7 @@
- (id) initWithWindow: (NSWindow *)window - (id) initWithWindow: (NSWindow *)window
{ {
[super init]; self = [super init];
ASSIGN (_window, window); ASSIGN (_window, window);
_windowFrameAutosaveName = @""; _windowFrameAutosaveName = @"";
@ -59,7 +71,7 @@
- (id) init - (id) init
{ {
return [self initWithWindowNibName: nil]; return [self initWithWindow: nil];
} }
- (void) dealloc - (void) dealloc
@ -161,7 +173,6 @@
{ {
_window = nil; _window = nil;
} }
[_document _removeWindowController: self]; [_document _removeWindowController: self];
} }
} }