swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error with lists


From: Paul E Johnson
Subject: Re: Error with lists
Date: Thu, 11 Jan 2001 08:40:08 -0600

I recall getting crashes when trying to remove the first element of an
empty list. I think you are causing the same errror--deleteAll applied
to an empty list tried to remove things from an empty. I suggest
inserting else as a fix (see below):

David Aliaga wrote:
> 

> I have the following code:
> 
> -(int)method1
> { int numEnemy=0;
> if(listOfSensations==nil) listOfSensations=[List
> create:[self getZone]];

   else
>  [listOfSensations deleteAll];//--> Sometimes it crash
> here!!
> 
>  // Other things here
> 
>  anEnemy=[[Enemy create: [self getZone]] setX: xS
> Y:yS];
> 
>      [listOfSensations addLast: anEnemy];
>                   numEnemy++;
> 
> // Other things --> Other times it crash here!
> 
> return(numEnemy)//--> Other here
> }


-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]