mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Check for nil when replacing object in array.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26525 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
320c516051
commit
3f13acae0e
2 changed files with 19 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
2008-05-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSArray.m: Fix bug allowing nil to be placed in array.
|
||||
|
||||
2008-05-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: try to use libffi on sparc64 as libffcall does not
|
||||
|
|
|
@ -714,6 +714,21 @@ static Class GSInlineArrayClass;
|
|||
{
|
||||
[self _raiseRangeExceptionWithIndex: index from: _cmd];
|
||||
}
|
||||
if (!anObject)
|
||||
{
|
||||
NSException *exception;
|
||||
NSDictionary *info;
|
||||
|
||||
info = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithUnsignedInt: index], @"Index",
|
||||
_contents_array[index], @"OLdObject",
|
||||
self, @"Array", nil, nil];
|
||||
|
||||
exception = [NSException exceptionWithName: NSInvalidArgumentException
|
||||
reason: @"Tried to replace object in array with nil"
|
||||
userInfo: info];
|
||||
[exception raise];
|
||||
}
|
||||
/*
|
||||
* Swap objects in order so that there is always a valid object in the
|
||||
* array in case a retain or release causes an exception.
|
||||
|
|
Loading…
Reference in a new issue