Index addition bugfix and avoid crash calling description on uninitialised

instance.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19397 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-05-25 04:29:08 +00:00
parent 1260b16a5a
commit 493eca3336
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2004-05-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSIndexSet.m: ([addIndexesInRange:]) fix bug finding insertion
point for new range. ([description]) check for uninitialised instance.
2004-05-24 Richard Frith-Macdonald <rfm@gnu.org> 2004-05-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDate.m: Implement -hash for abstract class and for the * Source/NSDate.m: Implement -hash for abstract class and for the

View file

@ -209,7 +209,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
- (NSString*) description - (NSString*) description
{ {
NSMutableString *m; NSMutableString *m;
unsigned c = GSIArrayCount(_array); unsigned c = (_array == 0) ? 0 : GSIArrayCount(_array);
unsigned i; unsigned i;
m = [NSMutableString stringWithFormat: m = [NSMutableString stringWithFormat:
@ -630,7 +630,7 @@ static unsigned posForIndex(GSIArray array, unsigned index)
} }
else else
{ {
NSRange r = GSIArrayItemAtIndex(_array, pos-1).ext; NSRange r = GSIArrayItemAtIndex(_array, pos).ext;
if (NSLocationInRange(aRange.location, r)) if (NSLocationInRange(aRange.location, r))
{ {