mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-09 16:38:45 +00:00
Throw an exception for -1 indexes in CPArray objectAtIndex:
This commit is contained in:
1 parent
2120e9cf2a
commit
e6d86eaa9b
1 file changed
+2
-2
@@ -521,8 +521,8 @@
|
||||
*/
|
||||
- (id)objectAtIndex:(int)anIndex
|
||||
{
|
||||
if (anIndex >= length)
|
||||
[CPException raise:CPRangeException reason:@"index (" + anIndex + @") beyond bounds (" + length + @")"];
|
||||
if (anIndex >= length || anIndex < 0)
|
||||
[CPException raise:CPRangeException reason:@"index (" + anIndex + @") out of bounds (0 - " + length + @")"];
|
||||
|
||||
return self[anIndex];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user