From afcf1c4e8ded3d6b8b6048508f2ba8a134333fe6 Mon Sep 17 00:00:00 2001 From: Dave Wetzel Date: Tue, 2 Apr 2002 18:26:02 +0000 Subject: [PATCH] startOneIterationWithIndex: list: inContext: checks range before accessing the array now. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@13324 72102866-910b-0410-8b05-ffd578937521 --- GSWeb.framework/GSWRepetition.m | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/GSWeb.framework/GSWRepetition.m b/GSWeb.framework/GSWRepetition.m index 98f3a4f..bc0e6f6 100644 --- a/GSWeb.framework/GSWRepetition.m +++ b/GSWeb.framework/GSWRepetition.m @@ -472,18 +472,27 @@ static char rcsId[] = "$Id$"; { component=[context component]; NSDebugMLLog(@"gswdync",@"_item=%@",_item); - if (_list && _item) - [_item setValue:[list objectAtIndex:currentIndex] - inComponent:component]; + + if (_list && _item) { + if ([list count]>currentIndex) { + [_item setValue:[list objectAtIndex:currentIndex] + inComponent:component]; + } else { + //NSLog(@"startOneIterationWithIndex SKIPPING setValue:inComponent index=%d list.count=%d",currentIndex, [list count]); + } + } + NSDebugMLLog(@"gswdync",@"currentIndex=%d",currentIndex); NSDebugMLLog(@"gswdync",@"_index=%@",_index); - if (_index) + if (_index) { [_index setValue:[NSNumber numberWithShort:currentIndex] - inComponent:component]; - if (currentIndex==0) + inComponent:component]; + } + if (currentIndex==0) { [context appendZeroElementIDComponent]; - else + } else { [context incrementLastElementIDComponent]; + } } NS_HANDLER {