Encourage better coding by warning about attempts to remove nil objects

from arrays.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5131 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-11-04 10:42:20 +00:00
parent b9fe4e75e2
commit 11d14c597d
6 changed files with 88 additions and 32 deletions

View file

@ -877,8 +877,14 @@ static NSString *indentStrings[] = {
- (void) removeObjectIdenticalTo: (id)anObject
{
unsigned i = [self count];
unsigned i;
if (anObject == nil)
{
NSLog(@"attempt to remove nil object");
return;
}
i = [self count];
if (i > 0)
{
IMP rem = 0;
@ -900,13 +906,22 @@ static NSString *indentStrings[] = {
- (void) removeObject: (id)anObject inRange: (NSRange)aRange
{
unsigned c = [self count];
unsigned s = aRange.location;
unsigned i = aRange.location + aRange.length;
unsigned c;
unsigned s;
unsigned i;
if (anObject == nil)
{
NSLog(@"attempt to remove nil object");
return;
}
c = [self count];
s = aRange.location;
i = aRange.location + aRange.length;
if (i > c)
i = c;
{
i = c;
}
if (i > s)
{
IMP rem = 0;
@ -930,13 +945,22 @@ static NSString *indentStrings[] = {
- (void) removeObjectIdenticalTo: (id)anObject inRange: (NSRange)aRange
{
unsigned c = [self count];
unsigned s = aRange.location;
unsigned i = aRange.location + aRange.length;
unsigned c;
unsigned s;
unsigned i;
if (anObject == nil)
{
NSLog(@"attempt to remove nil object");
return;
}
c = [self count];
s = aRange.location;
i = aRange.location + aRange.length;
if (i > c)
i = c;
{
i = c;
}
if (i > s)
{
IMP rem = 0;
@ -958,8 +982,14 @@ static NSString *indentStrings[] = {
- (void) removeObject: (id)anObject
{
unsigned i = [self count];
unsigned i;
if (anObject == nil)
{
NSLog(@"attempt to remove nil object");
return;
}
i = [self count];
if (i > 0)
{
IMP rem = 0;