Raise exceptions

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11357 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2001-11-10 03:53:33 +00:00
parent e82bd8f387
commit d38ba45c96
2 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2001-11-09 Adam Fedor <fedor@gnu.org>
* Source/NSView.m (-addSubview:): Raise exception on adding nil
subview or superview of view.
(-addSubview:positioned:relativeTo:): Likewise.
(-beginDocument): Change NSLog to exception.
Thu Nov 8 23:30:47 2001 Nicola Pero <n.pero@mi.flashnet.it> Thu Nov 8 23:30:47 2001 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSMatrix.m ([-sizeToFit]): Reverted last change. * Source/NSMatrix.m ([-sizeToFit]): Reverted last change.

View file

@ -285,10 +285,15 @@ GSSetDragTypes(NSView* obj, NSArray *types)
- (void) addSubview: (NSView*)aView - (void) addSubview: (NSView*)aView
{ {
if (aView == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Adding a nil subview"];
}
if ([self isDescendantOf: aView]) if ([self isDescendantOf: aView])
{ {
NSLog(@"Operation addSubview: creates a loop in the views tree!\n"); [NSException raise: NSInvalidArgumentException
return; format: @"addSubview: creates a loop in the views tree!\n"];
} }
RETAIN(aView); RETAIN(aView);
@ -313,11 +318,15 @@ GSSetDragTypes(NSView* obj, NSArray *types)
{ {
unsigned index; unsigned index;
if (aView == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"Adding a nil subview"];
}
if ([self isDescendantOf: aView]) if ([self isDescendantOf: aView])
{ {
NSLog(@"addSubview: positioned: relativeTo: will create a cycle " [NSException raise: NSInvalidArgumentException
@"in the views tree!\n"); format: @"addSubview: positioned: relativeTo: creates a loop in the views tree!\n"];
return;
} }
if (aView == otherView) if (aView == otherView)
@ -2852,8 +2861,8 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level)
dict = [[printOp printInfo] dictionary]; dict = [[printOp printInfo] dictionary];
if (printOp == nil) if (printOp == nil)
{ {
NSLog(@"[NSView -beginDocument] called without a current print op"); [NSException raise: NSInternalInconsistencyException
return; format: @"beginDocument called without a current print op"];
} }
/* Inform ourselves and subviews that we're printing so we adjust /* Inform ourselves and subviews that we're printing so we adjust
the PostScript accordingly. Perhaps this could be in the thread the PostScript accordingly. Perhaps this could be in the thread